diff --git a/.storybook/image-snapshots/expected/components_Button_Outline Buttons.png b/.storybook/image-snapshots/expected/components_Button_Outline Buttons.png index 180b5dbc4..80eae3bd4 100644 Binary files a/.storybook/image-snapshots/expected/components_Button_Outline Buttons.png and b/.storybook/image-snapshots/expected/components_Button_Outline Buttons.png differ diff --git a/.storybook/image-snapshots/expected/components_Button_Solid Buttons.png b/.storybook/image-snapshots/expected/components_Button_Solid Buttons.png index d32c7ca0f..cacb314bd 100644 Binary files a/.storybook/image-snapshots/expected/components_Button_Solid Buttons.png and b/.storybook/image-snapshots/expected/components_Button_Solid Buttons.png differ diff --git a/.storybook/image-snapshots/expected/components_Button_Text Buttons.png b/.storybook/image-snapshots/expected/components_Button_Text Buttons.png index 3214594b1..6c6e5575e 100644 Binary files a/.storybook/image-snapshots/expected/components_Button_Text Buttons.png and b/.storybook/image-snapshots/expected/components_Button_Text Buttons.png differ diff --git a/src/components/_internal/BaseButton/BaseStyledButton.tsx b/src/components/_internal/BaseButton/BaseStyledButton.tsx index 8583a2d4d..ef6af1689 100644 --- a/src/components/_internal/BaseButton/BaseStyledButton.tsx +++ b/src/components/_internal/BaseButton/BaseStyledButton.tsx @@ -34,11 +34,6 @@ const ButtonSolid = css` outline: 4px solid ${(p) => getToken(`color-action-${p.$color}-focus`, p)}; } - &:active, - &.active { - background-color: ${(p) => getToken(`color-action-${p.$color}-active`, p)}; - } - &:disabled, &.disabled { background-color: ${getToken(`color-action-background-disabled`)}; @@ -53,6 +48,8 @@ const ButtonOutline = css` &:hover, &.hover { + background-color: ${(p) => + getToken(`color-action-background-${p.$color}-active`, p)}; color: ${(p) => getToken(`color-action-${p.$color}-hover`, p)}; border-color: ${(p) => getToken(`color-action-${p.$color}-hover`, p)}; } @@ -62,13 +59,6 @@ const ButtonOutline = css` border-color: ${(p) => getToken(`color-action-${p.$color}-hover`, p)}; outline: 4px solid ${(p) => getToken(`color-action-${p.$color}-focus`, p)}; } - &:active, - &.active { - background-color: ${(p) => - getToken(`color-action-background-${p.$color}-active`, p)}; - border-color: ${(p) => getToken(`color-action-${p.$color}-active`, p)}; - color: ${(p) => getToken(`color-action-${p.$color}-active`, p)}; - } &:disabled, &.disabled { @@ -107,17 +97,6 @@ const ButtonText = css` outline: none; } - &:active, - &&&.active { - color: ${(p) => - getToken( - `color-action-${ - p.$color === 'primary' || p.$color === 'secondary' ? 'link-' : '' - }${p.$color}-active`, - p, - )}; - } - &:disabled, &.disabled { color: ${getToken(`color-action-text-disabled`)}; @@ -144,6 +123,8 @@ const BaseStyledButton = styled(Padbox).withConfig({ cursor: pointer; text-align: center; white-space: nowrap; + transition: all 300ms cubic-bezier(0.55, 0.085, 0.68, 0.53), + transform 50ms cubic-bezier(0.55, 0.085, 0.68, 0.53), outline 0ms; ${({ $margin }) => createMarginSpacing($margin)}; ${({ $isExpanded }) => $isExpanded && 'width: 100%;'}; @@ -169,6 +150,18 @@ const BaseStyledButton = styled(Padbox).withConfig({ &:active { text-decoration: none; } + + &:active, + &&&.active { + transform: scale(0.98); + } + + @media (prefers-reduced-motion) { + &:active, + &&&.active { + transform: scale(1); + } + } `; export default BaseStyledButton; diff --git a/src/theme/tokens.ts b/src/theme/tokens.ts index 6d7f728cc..fd0dbcaea 100644 --- a/src/theme/tokens.ts +++ b/src/theme/tokens.ts @@ -23,7 +23,7 @@ export const createTokens = ( 'color-action-secondary': colors.neutral[700], 'color-action-success': colors.success[700], 'color-action-danger': colors.error[500], - 'color-action-primary-hover': colors.primary[700], + 'color-action-primary-hover': colors.primary[800], 'color-action-secondary-hover': colors.neutral[900], 'color-action-success-hover': colors.success[800], 'color-action-danger-hover': colors.error[600],