From d8f45d10b08e0912e5398d5239c108da4373e5f6 Mon Sep 17 00:00:00 2001 From: Thisyahlen Date: Thu, 15 Feb 2024 09:43:20 +0800 Subject: [PATCH] chore: expose all props to button --- lib/components/Button/index.tsx | 21 +++++---------------- src/stories/Button.stories.ts | 2 +- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/lib/components/Button/index.tsx b/lib/components/Button/index.tsx index 903effdb..f737c509 100644 --- a/lib/components/Button/index.tsx +++ b/lib/components/Button/index.tsx @@ -8,37 +8,28 @@ import './Button.scss'; type TVariant = 'contained' | 'ghost' | 'outlined'; type TColor = 'black' | 'primary-light' | 'primary' | 'white'; -interface ButtonProps { - ariaLabel?: ComponentProps<'button'>['aria-label']; +interface ButtonProps extends ComponentProps<'button'> { color?: TColor; - disabled?: ComponentProps<'button'>['disabled']; icon?: ReactElement; isFullWidth?: boolean; isLoading?: boolean; - onClick?: ComponentProps<'button'>['onClick']; rounded?: Extract; size?: Extract; textSize?: ComponentProps['size']; - type?: ComponentProps<'button'>['type']; variant?: TVariant; - className?: string; } export const Button = ({ - ariaLabel, children, color = 'primary', - disabled = false, icon, isFullWidth = false, isLoading = false, - onClick, rounded = 'sm', size = 'md', textSize, - type, variant = 'contained', - className + ...props }: PropsWithChildren) => { const isContained = variant === 'contained'; @@ -49,7 +40,7 @@ export const Button = ({ `derivs-button__rounded--${rounded}`, isContained && `derivs-button__color--${color}`, isFullWidth && 'derivs-button__full-width', - className + props.className ); type TButtonFontColor = { @@ -94,11 +85,9 @@ export const Button = ({ return (