From 46d40cd49fed70fd5c2d02aa89ad21d3eaa77631 Mon Sep 17 00:00:00 2001 From: katty barroso Date: Thu, 26 Sep 2024 10:41:45 +0200 Subject: [PATCH] Fix secondary button --- fabric/src/components/Button/VisualButton.tsx | 38 ++++++++++++++----- fabric/src/components/Button/WalletButton.tsx | 8 ++++ fabric/src/theme/tokens/theme.ts | 20 +++++----- 3 files changed, 46 insertions(+), 20 deletions(-) diff --git a/fabric/src/components/Button/VisualButton.tsx b/fabric/src/components/Button/VisualButton.tsx index f16acb62ee..6670cf3404 100644 --- a/fabric/src/components/Button/VisualButton.tsx +++ b/fabric/src/components/Button/VisualButton.tsx @@ -89,9 +89,27 @@ export const StyledButton = styled.span( const borderDisabled = `borderButton${variantToken}Disabled` const shadow = `button${variantToken}` + const backgroundHover = () => { + if (isTertiaryIcon) return undefined + if ($variant === 'wallet') return 'backgroundInverted' + else return bgHover + } + + const backgroundActive = () => { + if (isTertiaryIcon) return undefined + if ($variant === 'wallet') return 'backgroundInverted' + else return bgPressed + } + + const backgroundFocus = () => { + if (isTertiaryIcon) return undefined + if ($variant === 'wallet') return 'backgroundInverted' + else return bgFocus + } + return css({ color: $disabled ? fgDisabled : $active ? fgHover : fg, - backgroundColor: $disabled ? bgDisabled : $active ? bgHover : bg, + backgroundColor: $disabled ? bgDisabled : $active && $variant !== 'wallet' ? bgHover : bg, borderColor: $disabled ? borderDisabled : $active ? borderHover : border, borderWidth: 1, borderRadius: 'button', @@ -100,20 +118,20 @@ export const StyledButton = styled.span( boxShadow: variant !== 'tertiary' && !$disabled ? shadow : 'none', '&:hover': { - color: fgHover, - backgroundColor: isTertiaryIcon ? undefined : bgHover, - borderColor: isTertiaryIcon ? undefined : borderHover, + color: $variant !== 'wallet' ? fgHover : fg, + backgroundColor: backgroundHover(), + borderColor: isTertiaryIcon || $variant === 'wallet' ? undefined : borderHover, }, '&:active': { - color: fgPressed, - backgroundColor: isTertiaryIcon ? undefined : bgPressed, - borderColor: isTertiaryIcon ? undefined : borderPressed, + color: $variant !== 'wallet' ? fgPressed : fg, + backgroundColor: backgroundActive(), + borderColor: isTertiaryIcon || $variant === 'wallet' ? undefined : borderPressed, }, 'a:focus-visible &, button:focus-visible &': { - color: fgFocus, - backgroundColor: isTertiaryIcon ? undefined : bgFocus, - borderColor: borderFocus, + color: $variant !== 'wallet' ? fgFocus : fg, + backgroundColor: backgroundFocus(), + borderColor: $variant === 'wallet' ? border : borderFocus, }, '& > :last-child': { diff --git a/fabric/src/components/Button/WalletButton.tsx b/fabric/src/components/Button/WalletButton.tsx index e89aab6536..f58b085acd 100644 --- a/fabric/src/components/Button/WalletButton.tsx +++ b/fabric/src/components/Button/WalletButton.tsx @@ -30,6 +30,14 @@ const StyledButton = styled.button` outline: 0; border-radius: 40px; white-space: nowrap; + + &:hover, + &:active, + &:focus { + background-color: ${({ theme }) => theme.colors.backgroundPrimary}; + outline: none; + box-shadow: none; + } ` const IdenticonWrapper = styled(Flex)({ diff --git a/fabric/src/theme/tokens/theme.ts b/fabric/src/theme/tokens/theme.ts index ebb7bf98a0..e25f6ad730 100644 --- a/fabric/src/theme/tokens/theme.ts +++ b/fabric/src/theme/tokens/theme.ts @@ -1,4 +1,4 @@ -import { black, blackScale, blueScale, gold, grayScale, yellowScale } from './colors' +import { black, blueScale, gold, grayScale, yellowScale } from './colors' const statusDefault = grayScale[800] const statusInfo = blueScale[500] @@ -65,19 +65,19 @@ const colors = { shadowButtonPrimary: 'transparent', backgroundButtonSecondary: black, - backgroundButtonSecondaryFocus: blackScale[500], - backgroundButtonSecondaryHover: blackScale[500], - backgroundButtonSecondaryPressed: blackScale[500], + backgroundButtonSecondaryFocus: 'white', + backgroundButtonSecondaryHover: 'white', + backgroundButtonSecondaryPressed: 'white', backgroundButtonSecondaryDisabled: grayScale[300], textButtonSecondary: 'white', - textButtonSecondaryFocus: gold, - textButtonSecondaryHover: gold, - textButtonSecondaryPressed: gold, + textButtonSecondaryFocus: black, + textButtonSecondaryHover: black, + textButtonSecondaryPressed: black, textButtonSecondaryDisabled: grayScale[500], borderButtonSecondary: grayScale[300], - borderButtonSecondaryFocus: gold, - borderButtonSecondaryHover: gold, - borderButtonSecondaryPressed: gold, + borderButtonSecondaryFocus: black, + borderButtonSecondaryHover: black, + borderButtonSecondaryPressed: black, borderButtonSecondaryDisabled: 'transparent', shadowButtonSecondary: 'transparent',