diff --git a/src/components/general/Button/Button.stories.tsx b/src/components/general/Button/Button.stories.tsx index 524d24629..e5618ec62 100644 --- a/src/components/general/Button/Button.stories.tsx +++ b/src/components/general/Button/Button.stories.tsx @@ -6,7 +6,7 @@ import React from 'react' const meta: Meta = { title: 'Aquarium/General/Button', - component: props => , + component: props => , args: { block: false, @@ -121,6 +121,14 @@ export const WithIconSM: Story = { }, } +export const WithIconDefaultColorSM: Story = { + args: { + type: 'default', + icon: , + variant: 'with-new-icon', + }, +} + export const RoundIconButton: Story = { args: { icon: , diff --git a/src/components/general/Button/Button.tsx b/src/components/general/Button/Button.tsx index 38231f7bc..8b34ded5b 100644 --- a/src/components/general/Button/Button.tsx +++ b/src/components/general/Button/Button.tsx @@ -1,6 +1,10 @@ +import React from 'react' import { Button as AntButton } from 'antd' import { type ButtonProps as AntButtonProps } from 'antd' +import { Icon } from 'src/components' +import type { IIconProps } from 'src/components' import { ConfigProvider } from 'src/components/other/ConfigProvider/ConfigProvider' +import { type ReactNode } from 'react' export interface IButtonProps extends AntButtonProps { /** @@ -9,15 +13,26 @@ export interface IButtonProps extends AntButtonProps { * This will be removed once all icons are updated. */ variant?: 'with-new-icon' + icon?: ReactNode } export const Button = (props: IButtonProps) => { const classMap = { 'with-new-icon': 'u-display-flex u-align-items-center u-justify-center', } + const buttonIcon = + React.isValidElement(props.icon) && props.icon.type === Icon ? ( + + ) : ( + props.icon + ) + return ( - + {props.children} diff --git a/src/components/general/Icon/Icon.tsx b/src/components/general/Icon/Icon.tsx index d95bdb459..9a34515cb 100644 --- a/src/components/general/Icon/Icon.tsx +++ b/src/components/general/Icon/Icon.tsx @@ -16,6 +16,7 @@ export type IconColor = | 'text' | 'strong' | 'brand' + | 'inherit' export interface IIconProps { name: IconNames diff --git a/src/components/general/Icon/icon.css b/src/components/general/Icon/icon.css index cdd08efd8..7e3d3385d 100644 --- a/src/components/general/Icon/icon.css +++ b/src/components/general/Icon/icon.css @@ -89,3 +89,7 @@ .icon-color-black { color: black; } + +.icon-color-inherit { + color: inherit; +}