Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve button hover and focus colors #3451

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/roomkit-react/src/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const getOutlinedVariants = (
disabled: string,
text: string,
textDisabled: string,
textHover?: string,
) => {
return {
bg: 'transparent',
Expand All @@ -30,6 +31,7 @@ const getOutlinedVariants = (
cursor: 'not-allowed',
},
'&:not([disabled]):hover': {
c: textHover,
border: `solid $space$px $colors${hover}`,
bg: 'transparent',
},
Expand All @@ -50,6 +52,7 @@ const getButtonVariants = (
disabled: string,
text: string,
textDisabled: string,
textHover?: string,
) => {
return {
bg: base,
Expand All @@ -62,6 +65,7 @@ const getButtonVariants = (
border: `1px solid ${disabled}`,
},
'&:not([disabled]):hover': {
c: textHover,
bg: hover,
border: `1px solid ${hover}`,
},
Expand All @@ -70,7 +74,7 @@ const getButtonVariants = (
border: `1px solid ${active}`,
},
'&:not([disabled]):focus-visible': {
boxShadow: `0 0 0 3px ${base}`,
boxShadow: `0 0 0 3px $colors${hover}`,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. ${base} was rendering an invalid CSS var here. Add $colors fixed that
  2. ${base} is the background color, so it was blending in. using ${hover} instead is clearer

},
};
};
Expand Down Expand Up @@ -121,6 +125,7 @@ const StyledButton = styled('button', {
'$alert_error_brighter',
'$on_surface_high',
'$on_surface_low',
'$on_surface_high',
),
},
{
Expand Down Expand Up @@ -153,6 +158,7 @@ const StyledButton = styled('button', {
'$alert_error_dim',
'$alert_error_brighter',
'$on_primary_low',
'$on_primary_high',
),
primary: getButtonVariants(
'$primary_default',
Expand Down