From 904412e1fa00707ceefc82d332e9d8b2767535f8 Mon Sep 17 00:00:00 2001 From: maxichrome Date: Mon, 2 May 2022 18:58:53 -0500 Subject: [PATCH] update button ting --- packages/ui/src/Button.tsx | 54 ++++++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/packages/ui/src/Button.tsx b/packages/ui/src/Button.tsx index 97ea5aed6..f041d3770 100644 --- a/packages/ui/src/Button.tsx +++ b/packages/ui/src/Button.tsx @@ -105,25 +105,39 @@ type Button = { const hasHref = (props: ButtonElementProps | AnchorElementProps): props is AnchorElementProps => 'href' in props; -export const Button: Button = ({ loading, justifyLeft, ...props }) => { - const Element = hasHref(props) ? 'a' : 'button'; - - return ( - // @ts-expect-error -- this does not actually dynamically adjust its expectations for some reason :P - - {props.children} - +export const Button: Button = ({ + loading, + justifyLeft, + variant, + size, + icon, + noPadding, + noBorder, + pressEffect, + className, + ...props +}) => { + className = clsx( + 'border rounded-md items-center transition-colors duration-100 cursor-default no-underline', + { 'opacity-5': loading, '!p-1': noPadding }, + { 'justify-center': !justifyLeft }, + sizes[size || 'default'], + variants[variant || 'default'], + { 'active:translate-y-[1px]': pressEffect }, + { 'border-0': noBorder }, + className ); + + if (hasHref(props)) + return ( + + {props.children} + + ); + else + return ( + + ); };