diff --git a/src/components/PrimaryButton.stories.tsx b/src/components/PrimaryButton.stories.tsx index 8705113..dc86fdb 100644 --- a/src/components/PrimaryButton.stories.tsx +++ b/src/components/PrimaryButton.stories.tsx @@ -16,6 +16,16 @@ export const Basic = { }, } satisfies Story; +export const Sizes = { + render: () => ( +
+ Small + Medium + Large +
+ ), +} satisfies Story; + export const Block = { args: { ...Basic.args, diff --git a/src/components/PrimaryButton.tsx b/src/components/PrimaryButton.tsx index 7990d9a..5b2b8e9 100644 --- a/src/components/PrimaryButton.tsx +++ b/src/components/PrimaryButton.tsx @@ -14,12 +14,23 @@ export type PrimaryButtonElementType = ReactElementType< >; export type PrimaryButtonProps = - Merge, { as?: T }>; + Merge< + React.ComponentPropsWithoutRef, + { + as?: T; + size?: "sm" | "md" | "lg"; + } + >; export const PrimaryButton = forwardRefWithGenerics(function PrimaryButton< T extends PrimaryButtonElementType = "button", >( - { as = "button" as T, className, ...props }: PrimaryButtonProps, + { + as = "button" as T, + size = "md", + className, + ...props + }: PrimaryButtonProps, ref: React.ForwardedRef>, ) { const Element: PrimaryButtonElementType = as; @@ -30,7 +41,12 @@ export const PrimaryButton = forwardRefWithGenerics(function PrimaryButton< } className={clsx( className, - "inline-flex h-10 items-center justify-center rounded-lg bg-ui-primary-3 px-4 text-center text-base font-semibold leading-none text-ui-primary-0 transition-colors hover:bg-ui-primary-4", + { + "h-8 px-3 text-sm leading-none": size === "sm", + "h-10 px-4 text-base leading-none": size === "md", + "h-14 px-6 text-xl leading-none": size === "lg", + }, + "inline-flex items-center justify-center rounded-lg bg-ui-primary-3 text-center font-semibold text-ui-primary-0 transition-colors hover:bg-ui-primary-4", )} {...props} />