Files
web/packages/design-system/lib/components/IconButton/iconButton.module.css
Erik Tiekstra 6730575f7a feat(BOOK-113): Synced hover/focus states for buttons and added better examples to storybook
* fix(BOOK-113): Updated hover colors after blend/mix has been removed

Approved-by: Christel Westerberg
2025-12-03 10:45:34 +00:00

158 lines
3.9 KiB
CSS

.iconButton {
position: relative;
border-radius: var(--Corner-radius-rounded);
border-width: 0;
cursor: pointer;
display: inline-flex;
align-items: center;
justify-content: center;
padding: 10px;
&[data-disabled] {
cursor: unset;
}
&:focus-visible {
outline: 2px solid var(--Border-Interactive-Focus);
outline-offset: 2px;
}
}
.theme-primary {
background-color: var(--Component-Button-Brand-Primary-Fill-Default);
color: var(--Component-Button-Brand-Primary-On-fill-Default);
@media (hover: hover) {
&:hover:not([data-disabled]) {
background:
linear-gradient(
0deg,
var(--Component-Button-Brand-Primary-Fill-Hover) 0%,
var(--Component-Button-Brand-Primary-Fill-Hover) 100%
),
var(--Component-Button-Brand-Primary-Fill-Default);
color: var(--Component-Button-Brand-Primary-On-fill-Hover);
}
}
/* This theme is able to be on top of dark background colors,
so we need to create an illusion that it also has an inverted border on focus */
&:focus-visible::after {
content: '';
position: absolute;
inset: -2px;
border: 2px solid var(--Border-Inverted);
border-radius: inherit;
pointer-events: none;
}
&[data-disabled] {
background-color: var(--Component-Button-Brand-Primary-Fill-Disabled);
color: var(--Component-Button-Brand-Primary-On-fill-Disabled);
}
}
.theme-inverted {
background-color: var(--Component-Button-Inverted-Fill-Default);
color: var(--Component-Button-Inverted-On-fill-Default);
@media (hover: hover) {
&:hover:not([data-disabled]) {
background:
linear-gradient(
0deg,
var(--Component-Button-Inverted-Fill-Hover) 0%,
var(--Component-Button-Inverted-Fill-Hover) 100%
),
var(--Component-Button-Inverted-Fill-Default);
}
}
&[data-disabled] {
background-color: var(--Component-Button-Inverted-Fill-Disabled);
color: var(--Component-Button-Inverted-On-fill-Disabled);
}
&.style-muted {
background-color: var(--Component-Button-Muted-Fill-Default);
color: var(--Component-Button-Muted-On-fill-Inverted);
@media (hover: hover) {
&:hover:not(:disabled) {
background-color: var(--Component-Button-Muted-Fill-Hover);
}
}
&:focus-visible {
outline-color: var(--Border-Inverted);
}
&[data-disabled] {
color: var(--Component-Button-Muted-On-fill-Disabled);
}
}
}
.theme-tertiary {
background-color: var(--Component-Button-Brand-Tertiary-Fill-Default);
color: var(--Component-Button-Brand-Tertiary-On-fill-Default);
@media (hover: hover) {
&:hover:not([data-disabled]) {
background:
linear-gradient(
0deg,
var(--Component-Button-Brand-Tertiary-Fill-Hover) 0%,
var(--Component-Button-Brand-Tertiary-Fill-Hover) 100%
),
var(--Component-Button-Brand-Tertiary-Fill-Default);
color: var(--Component-Button-Brand-Tertiary-On-fill-Hover);
}
}
&[data-disabled] {
background-color: var(--Component-Button-Brand-Tertiary-Fill-Disabled);
color: var(--Component-Button-Brand-Tertiary-On-fill-Disabled);
}
}
.theme-black {
color: var(--Component-Button-Muted-On-fill-Default);
@media (hover: hover) {
&:hover:not([data-disabled]) {
color: var(--Component-Button-Muted-On-fill-Hover-Inverted);
}
}
&[data-disabled] {
color: var(--Component-Button-Muted-On-fill-Disabled);
}
}
.style-elevated {
box-shadow: 0px 0px 8px 1px #0000001a;
}
.style-faded {
background-color: var(--Component-Button-Inverted-Fill-Faded);
}
.style-muted {
background-color: var(--Component-Button-Muted-Fill-Default);
@media (hover: hover) {
&:hover:not([data-disabled]) {
background-color: var(--Component-Button-Muted-Fill-Hover-inverted);
}
}
&[data-disabled] {
background-color: var(--Component-Button-Muted-Fill-Disabled-inverted);
}
}
.no-wrapping {
padding: 0;
}