diff --git a/packages/lsd-react/src/components/Button/Button.classes.ts b/packages/lsd-react/src/components/Button/Button.classes.ts index f27fa6e..3852aa7 100644 --- a/packages/lsd-react/src/components/Button/Button.classes.ts +++ b/packages/lsd-react/src/components/Button/Button.classes.ts @@ -6,6 +6,8 @@ export const buttonClasses = { large: `${LSD_NAMESPACE}--large`, medium: `${LSD_NAMESPACE}--medium`, small: `${LSD_NAMESPACE}--small`, + withIcon: `${LSD_NAMESPACE}--with-icon`, text: `${LSD_NAMESPACE}-button__text`, + icon: `${LSD_NAMESPACE}-button__icon`, } diff --git a/packages/lsd-react/src/components/Button/Button.stories.tsx b/packages/lsd-react/src/components/Button/Button.stories.tsx index d834efa..17d8977 100644 --- a/packages/lsd-react/src/components/Button/Button.stories.tsx +++ b/packages/lsd-react/src/components/Button/Button.stories.tsx @@ -1,14 +1,42 @@ import { Meta, Story } from '@storybook/react' +import { useStorybookIconComponent } from '../../utils/storybook.utils' import { Button, ButtonProps } from './Button' export default { title: 'Button', component: Button, + argTypes: { + size: { + type: { + name: 'enum', + value: ['small', 'medium', 'large'], + }, + defaultValue: 'large', + }, + icon: { + type: { + name: 'enum', + value: useStorybookIconComponent.options, + }, + }, + }, } as Meta -export const Root: Story = (args) => ( - -) +export const Root: Story = ({ + icon, + ...args +}) => { + const IconComponent = useStorybookIconComponent(icon) + return ( + + ) +} + Root.args = { disabled: false, } diff --git a/packages/lsd-react/src/components/Button/Button.styles.ts b/packages/lsd-react/src/components/Button/Button.styles.ts index df6e2aa..ce56b9d 100644 --- a/packages/lsd-react/src/components/Button/Button.styles.ts +++ b/packages/lsd-react/src/components/Button/Button.styles.ts @@ -22,6 +22,7 @@ export const ButtonStyles = css` } .${buttonClasses.medium} { + padding: 6px, 24px; } .${buttonClasses.small} { @@ -35,4 +36,33 @@ export const ButtonStyles = css` } } } + + .${buttonClasses.withIcon} { + display: flex; + } + + .${buttonClasses.icon} { + display: flex; + } + + .${buttonClasses.large}.${buttonClasses.withIcon} { + padding: 10px 14px 10px 18px; + .${buttonClasses.icon} { + margin-left: 18px; + } + } + + .${buttonClasses.medium}.${buttonClasses.withIcon} { + padding: 6px 12px 6px 14px; + .${buttonClasses.icon} { + margin-left: 14px; + } + } + + .${buttonClasses.small}.${buttonClasses.withIcon} { + padding: 6px 10px 6px 12px; + .${buttonClasses.icon} { + margin-left: 10px; + } + } ` diff --git a/packages/lsd-react/src/components/Button/Button.tsx b/packages/lsd-react/src/components/Button/Button.tsx index deb9685..d6bc10f 100644 --- a/packages/lsd-react/src/components/Button/Button.tsx +++ b/packages/lsd-react/src/components/Button/Button.tsx @@ -4,11 +4,12 @@ import { buttonClasses } from './Button.classes' export type ButtonProps = React.ButtonHTMLAttributes & { size?: 'large' | 'medium' | 'small' + icon: React.ReactNode } export const Button: React.FC & { classes: typeof buttonClasses -} = ({ size = 'medium', children, ...props }) => { +} = ({ size = 'medium', icon, children, ...props }) => { return ( <> ) diff --git a/packages/lsd-react/src/components/Icons/PickIcon/PickIcon.tsx b/packages/lsd-react/src/components/Icons/PickIcon/PickIcon.tsx new file mode 100644 index 0000000..4bc1027 --- /dev/null +++ b/packages/lsd-react/src/components/Icons/PickIcon/PickIcon.tsx @@ -0,0 +1,22 @@ +import { LsdIcon } from '../LsdIcon' + +export const PickIcon = LsdIcon( + (props) => ( + + + + ), + { filled: true }, +) diff --git a/packages/lsd-react/src/components/Icons/PickIcon/index.ts b/packages/lsd-react/src/components/Icons/PickIcon/index.ts new file mode 100644 index 0000000..6fd6c8b --- /dev/null +++ b/packages/lsd-react/src/components/Icons/PickIcon/index.ts @@ -0,0 +1 @@ +export * from './PickIcon' diff --git a/packages/lsd-react/src/components/Icons/index.ts b/packages/lsd-react/src/components/Icons/index.ts index d046975..40f1f7f 100644 --- a/packages/lsd-react/src/components/Icons/index.ts +++ b/packages/lsd-react/src/components/Icons/index.ts @@ -16,3 +16,4 @@ export * from './NavigateBeforeIcon' export * from './NavigateNextIcon' export * from './NewPageIcon' export * from './SearchIcon' +export * from './PickIcon'