From 88b75eb701fd840c67cf214b232dd25d29002e9c Mon Sep 17 00:00:00 2001 From: GauthierWebDev Date: Sun, 20 Apr 2025 16:51:00 +0200 Subject: [PATCH] refactor: Simplify Button and Callout components parameters --- app/components/Button.tsx | 17 ++++++----------- app/components/Callout.tsx | 21 +++++++++------------ app/partials/MobileNavigation.tsx | 10 +++++----- 3 files changed, 20 insertions(+), 28 deletions(-) diff --git a/app/components/Button.tsx b/app/components/Button.tsx index 1b374e0..177b042 100644 --- a/app/components/Button.tsx +++ b/app/components/Button.tsx @@ -27,24 +27,19 @@ type ButtonProps = { | (JSX.IntrinsicElements["a"] & { href: string }) ); -export function Button({ - variant = "primary", - size = "md", - className, - ...props -}: ButtonProps) { - className = clsx( - variantStyles[variant], - sizeStyles[size], +export function Button(props: ButtonProps) { + const className = clsx( + variantStyles[props.variant ?? "primary"], + sizeStyles[props.size ?? "md"], "cursor-pointer", - className, + props.className, ); return "href" in props && props.href ? ( ) : (