Skip to content

Commit 7de66c5

Browse files
committed
refactor: accept size and variant as direct props
1 parent a8ecc60 commit 7de66c5

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/components/ui/buttons/Button.tsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,25 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
108108
)
109109
Button.displayName = "Button"
110110

111-
type ButtonLinkProps = Omit<LinkProps, "onClick"> & {
112-
buttonProps?: ButtonProps
113-
customEventOptions?: MatomoEventOptions
114-
}
111+
type ButtonLinkProps = Omit<LinkProps, "onClick"> &
112+
Pick<ButtonProps, "size" | "variant"> & {
113+
buttonProps?: Omit<ButtonProps, "size" | "variant">
114+
customEventOptions?: MatomoEventOptions
115+
}
115116

116117
const ButtonLink = React.forwardRef<HTMLAnchorElement, ButtonLinkProps>(
117118
(
118-
{ buttonProps, customEventOptions, children, className, ...linkProps },
119+
{
120+
size,
121+
variant,
122+
buttonProps,
123+
customEventOptions,
124+
children,
125+
className,
126+
...linkProps
127+
},
119128
ref
120129
) => {
121-
const { size, variant } = buttonProps || {}
122130
const handleClick = () => {
123131
customEventOptions && trackCustomEvent(customEventOptions)
124132
}

0 commit comments

Comments
 (0)