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

feat: added color to IconButton's hover and active selectors #465

Merged
merged 2 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -512,11 +512,13 @@ exports[`Storybook Tests DropdownSelector InModal 1`] = `

.c12:not(:disabled):not([aria-disabled]):hover,
.c12[aria-disabled='false']:hover {
color: var(--charcoal-text3-hover);
background-color: var(--charcoal-transparent-hover);
}

.c12:not(:disabled):not([aria-disabled]):active,
.c12[aria-disabled='false']:active {
color: var(--charcoal-text3-press);
background-color: var(--charcoal-transparent-press);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,13 @@ exports[`Storybook Tests IconButton DefaultM 1`] = `

.c1:not(:disabled):not([aria-disabled]):hover,
.c1[aria-disabled='false']:hover {
color: var(--charcoal-text3-hover);
background-color: var(--charcoal-transparent-hover);
}

.c1:not(:disabled):not([aria-disabled]):active,
.c1[aria-disabled='false']:active {
color: var(--charcoal-text3-press);
background-color: var(--charcoal-transparent-press);
}

Expand Down Expand Up @@ -177,6 +179,7 @@ exports[`Storybook Tests IconButton IsActive 1`] = `

.c1:not(:disabled):not([aria-disabled]),
.c1[aria-disabled='false'] {
color: var(--charcoal-text3-press);
background-color: var(--charcoal-transparent-press);
}

Expand Down Expand Up @@ -282,11 +285,13 @@ exports[`Storybook Tests IconButton OverlayM 1`] = `

.c1:not(:disabled):not([aria-disabled]):hover,
.c1[aria-disabled='false']:hover {
color: var(--charcoal-text5-hover);
background-color: var(--charcoal-surface4-hover);
}

.c1:not(:disabled):not([aria-disabled]):active,
.c1[aria-disabled='false']:active {
color: var(--charcoal-text5-press);
background-color: var(--charcoal-surface4-press);
}

Expand Down
5 changes: 4 additions & 1 deletion packages/react/src/components/IconButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,19 @@ const StyledIconButton = styled(Clickable).attrs<

&:not(:disabled):not([aria-disabled]),
&[aria-disabled='false'] {
${({ $isActive, $background }) =>
${({ $isActive, $background, $font }) =>
$isActive
? css`
color: var(--charcoal-${$font}-press);
background-color: var(--charcoal-${$background}-press);
`
: css`
&:hover {
color: var(--charcoal-${$font}-hover);
background-color: var(--charcoal-${$background}-hover);
}
&:active {
color: var(--charcoal-${$font}-press);
background-color: var(--charcoal-${$background}-press);
}
`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,13 @@ exports[`Storybook Tests Modal BottomSheet 1`] = `

.c13:not(:disabled):not([aria-disabled]):hover,
.c13[aria-disabled='false']:hover {
color: var(--charcoal-text3-hover);
background-color: var(--charcoal-transparent-hover);
}

.c13:not(:disabled):not([aria-disabled]):active,
.c13[aria-disabled='false']:active {
color: var(--charcoal-text3-press);
background-color: var(--charcoal-transparent-press);
}

Expand Down Expand Up @@ -912,11 +914,13 @@ exports[`Storybook Tests Modal Default 1`] = `

.c27:not(:disabled):not([aria-disabled]):hover,
.c27[aria-disabled='false']:hover {
color: var(--charcoal-text3-hover);
background-color: var(--charcoal-transparent-hover);
}

.c27:not(:disabled):not([aria-disabled]):active,
.c27[aria-disabled='false']:active {
color: var(--charcoal-text3-press);
background-color: var(--charcoal-transparent-press);
}

Expand Down Expand Up @@ -1725,11 +1729,13 @@ exports[`Storybook Tests Modal FullBottomSheet 1`] = `

.c22:not(:disabled):not([aria-disabled]):hover,
.c22[aria-disabled='false']:hover {
color: var(--charcoal-text3-hover);
background-color: var(--charcoal-transparent-hover);
}

.c22:not(:disabled):not([aria-disabled]):active,
.c22[aria-disabled='false']:active {
color: var(--charcoal-text3-press);
background-color: var(--charcoal-transparent-press);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1352,11 +1352,13 @@ exports[`Storybook Tests TextField PrefixIcon 1`] = `

.c12:not(:disabled):not([aria-disabled]):hover,
.c12[aria-disabled='false']:hover {
color: var(--charcoal-text5-hover);
background-color: var(--charcoal-surface4-hover);
}

.c12:not(:disabled):not([aria-disabled]):active,
.c12[aria-disabled='false']:active {
color: var(--charcoal-text5-press);
background-color: var(--charcoal-surface4-press);
}

Expand Down
Loading