update button variant call

This commit is contained in:
Nate Kelley 2025-02-24 19:20:47 -07:00
parent f8bf374772
commit bf41ba0e68
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
3 changed files with 23 additions and 29 deletions

View File

@ -1,3 +1 @@
export * from './BusterLogoWithText';
export * from './BusterFrameLogoWithText';
export * from './Status_NotRequested'; export * from './Status_NotRequested';

View File

@ -14,7 +14,7 @@ const meta: Meta<typeof Button> = {
children: 'Button' children: 'Button'
}, },
argTypes: { argTypes: {
buttonType: { variant: {
control: 'select', control: 'select',
options: ['default', 'black', 'primary', 'ghost', 'link', 'danger', 'warning', 'success'] options: ['default', 'black', 'primary', 'ghost', 'link', 'danger', 'warning', 'success']
}, },
@ -69,35 +69,35 @@ type Story = StoryObj<typeof Button>;
export const Default: Story = { export const Default: Story = {
args: { args: {
buttonType: 'default', variant: 'default',
size: 'default' size: 'default'
} }
}; };
export const Black: Story = { export const Black: Story = {
args: { args: {
buttonType: 'black', variant: 'black',
size: 'default' size: 'default'
} }
}; };
export const Primary: Story = { export const Primary: Story = {
args: { args: {
buttonType: 'primary', variant: 'primary',
size: 'default' size: 'default'
} }
}; };
export const Tall: Story = { export const Tall: Story = {
args: { args: {
buttonType: 'default', variant: 'default',
size: 'tall' size: 'tall'
} }
}; };
export const Disabled: Story = { export const Disabled: Story = {
args: { args: {
buttonType: 'default', variant: 'default',
size: 'default', size: 'default',
disabled: true disabled: true
} }
@ -112,7 +112,7 @@ export const AsChild: Story = {
export const Loading: Story = { export const Loading: Story = {
args: { args: {
buttonType: 'default', variant: 'default',
size: 'default', size: 'default',
loading: true loading: true
} }
@ -120,35 +120,35 @@ export const Loading: Story = {
export const WithBorder: Story = { export const WithBorder: Story = {
args: { args: {
buttonType: 'default', variant: 'default',
size: 'default' size: 'default'
} }
}; };
export const Ghost: Story = { export const Ghost: Story = {
args: { args: {
buttonType: 'ghost', variant: 'ghost',
size: 'default' size: 'default'
} }
}; };
export const Link: Story = { export const Link: Story = {
args: { args: {
buttonType: 'link', variant: 'link',
size: 'default' size: 'default'
} }
}; };
export const Small: Story = { export const Small: Story = {
args: { args: {
buttonType: 'default', variant: 'default',
size: 'small' size: 'small'
} }
}; };
export const IconButton: Story = { export const IconButton: Story = {
args: { args: {
buttonType: 'default', variant: 'default',
size: 'default', size: 'default',
prefix: 'ShapeSquare', prefix: 'ShapeSquare',
children: '' children: ''
@ -157,7 +157,7 @@ export const IconButton: Story = {
export const Block: Story = { export const Block: Story = {
args: { args: {
buttonType: 'primary', variant: 'primary',
size: 'default', size: 'default',
block: true, block: true,
children: 'Full Width Button' children: 'Full Width Button'

View File

@ -20,7 +20,7 @@ interface ButtonDropdownProps {
disabled?: boolean; disabled?: boolean;
rounding?: ButtonProps['rounding']; rounding?: ButtonProps['rounding'];
size?: ButtonProps['size']; size?: ButtonProps['size'];
buttonType?: ButtonProps['buttonType']; variant?: ButtonProps['variant'];
loading?: boolean; loading?: boolean;
className?: string; className?: string;
iconClassName?: string; iconClassName?: string;
@ -41,13 +41,13 @@ const dropdownButtonVariants = cva('flex items-center pr-0', {
const primaryButtonVariants = cva('', { const primaryButtonVariants = cva('', {
variants: { variants: {
buttonType: buttonTypeClasses variant: buttonTypeClasses
} }
}); });
const splitButtonVariants = cva('flex w-full items-center justify-center h-full px-[5px]', { const splitButtonVariants = cva('flex w-full items-center justify-center h-full px-[5px]', {
variants: { variants: {
buttonType: buttonTypeClasses variant: buttonTypeClasses
} }
}); });
@ -78,7 +78,7 @@ export const ButtonSplit = React.memo(
( (
{ {
className, className,
buttonType = 'default', variant = 'default',
size = 'default', size = 'default',
icon, icon,
buttonText, buttonText,
@ -100,7 +100,7 @@ export const ButtonSplit = React.memo(
<div <div
ref={ref} ref={ref}
className={cn( className={cn(
buttonVariants({ buttonType, size, rounding: 'none' }), buttonVariants({ variant, size, rounding: 'none' }),
dropdownButtonVariants({ rounding }), dropdownButtonVariants({ rounding }),
'gap-0 !bg-transparent p-0', 'gap-0 !bg-transparent p-0',
disabled && 'cursor-not-allowed opacity-70', disabled && 'cursor-not-allowed opacity-70',
@ -108,19 +108,15 @@ export const ButtonSplit = React.memo(
)}> )}>
<div <div
className={cn( className={cn(
primaryButtonVariants({ buttonType }), primaryButtonVariants({ variant }),
'flex h-full items-center gap-0.5 border-none pr-2 pl-2.5' 'flex h-full items-center gap-0.5 border-none pr-2 pl-2.5'
)}> )}>
{loading ? ( {loading ? (
<LoadingIcon buttonType={buttonType} size={size} /> <LoadingIcon variant={variant} size={size} />
) : ( ) : (
icon && ( icon && (
<span <span
className={cn( className={cn(buttonIconVariants({ variant, size }), 'text-sm', iconClassName)}>
buttonIconVariants({ buttonType, size }),
'text-sm',
iconClassName
)}>
{icon} {icon}
</span> </span>
) )
@ -130,7 +126,7 @@ export const ButtonSplit = React.memo(
<div className="bg-border mr-0 h-full w-[0.5px]" /> <div className="bg-border mr-0 h-full w-[0.5px]" />
<div className="flex h-full items-center justify-center text-sm" onClick={handleClick}> <div className="flex h-full items-center justify-center text-sm" onClick={handleClick}>
<div <div
className={cn(splitButtonVariants({ buttonType }), 'border-none')} className={cn(splitButtonVariants({ variant }), 'border-none')}
aria-label="Open dropdown menu"> aria-label="Open dropdown menu">
<span <span
className={cn( className={cn(
@ -149,7 +145,7 @@ export const ButtonSplit = React.memo(
(prevProps, nextProps) => { (prevProps, nextProps) => {
return ( return (
prevProps.className === nextProps.className && prevProps.className === nextProps.className &&
prevProps.buttonType === nextProps.buttonType && prevProps.variant === nextProps.variant &&
prevProps.size === nextProps.size && prevProps.size === nextProps.size &&
prevProps.icon === nextProps.icon && prevProps.icon === nextProps.icon &&
prevProps.buttonText === nextProps.buttonText && prevProps.buttonText === nextProps.buttonText &&