208 lines
5.3 KiB
SCSS
208 lines
5.3 KiB
SCSS
@mixin button-variant($context) {
|
|
white-space: nowrap;
|
|
&:hover,
|
|
&:focus-visible {
|
|
border-radius: var(--c--components--button--border-radius--focus);
|
|
}
|
|
|
|
&--primary {
|
|
background-color: var(--c--contextuals--background--semantic--#{$context}--primary);
|
|
color: var(--c--contextuals--content--semantic--#{$context}--on-#{$context});
|
|
|
|
&:focus-visible {
|
|
box-shadow:
|
|
0 0 0 1px #fff,
|
|
0 0 0 4px var(--c--contextuals--border--semantic--#{$context}--primary);
|
|
}
|
|
&:hover,
|
|
&:focus-visible {
|
|
background-color: var(
|
|
--c--contextuals--background--semantic--#{$context}--primary-hover
|
|
);
|
|
|
|
}
|
|
|
|
&:disabled {
|
|
background-color: var(--c--contextuals--background--semantic--disabled--primary);
|
|
color: var(--c--contextuals--content--semantic--disabled--primary);
|
|
}
|
|
}
|
|
|
|
&--secondary {
|
|
background-color: var(--c--contextuals--background--semantic--#{$context}--secondary);
|
|
color: var(--c--contextuals--content--semantic--#{$context}--secondary);
|
|
|
|
&:focus-visible {
|
|
box-shadow:
|
|
0 0 0 1px #fff,
|
|
0 0 0 4px var(--c--contextuals--border--semantic--#{$context}--primary);
|
|
}
|
|
&:hover,
|
|
&:focus-visible {
|
|
background-color: var(
|
|
--c--contextuals--background--semantic--#{$context}--secondary-hover
|
|
);
|
|
}
|
|
|
|
&:disabled {
|
|
background-color: var(--c--contextuals--background--semantic--disabled--secondary);
|
|
color: var(--c--contextuals--content--semantic--disabled--primary);
|
|
}
|
|
}
|
|
|
|
&--tertiary {
|
|
background-color: transparent;
|
|
color: var(--c--contextuals--content--semantic--#{$context}--tertiary);
|
|
|
|
&:focus-visible {
|
|
box-shadow:
|
|
0 0 0 1px #fff,
|
|
0 0 0 4px var(--c--contextuals--border--semantic--#{$context}--primary);
|
|
}
|
|
&:hover,
|
|
&:focus-visible {
|
|
background-color: var(--c--contextuals--background--semantic--contextual--primary);
|
|
}
|
|
|
|
&:disabled {
|
|
background-color: transparent;
|
|
color: var(--c--contextuals--content--semantic--disabled--primary);
|
|
}
|
|
}
|
|
|
|
&--bordered {
|
|
border: 1px solid var(--c--contextuals--border--semantic--neutral--tertiary);
|
|
background-color: transparent;
|
|
color: var(--c--contextuals--content--semantic--#{$context}--tertiary);
|
|
|
|
&:focus-visible {
|
|
box-shadow:
|
|
0 0 0 1px #fff,
|
|
0 0 0 4px var(--c--contextuals--border--semantic--#{$context}--primary);
|
|
}
|
|
&:hover,
|
|
&:focus-visible {
|
|
background-color: var(--c--contextuals--background--semantic--contextual--primary);
|
|
}
|
|
|
|
&:disabled {
|
|
background-color: transparent;
|
|
color: var(--c--contextuals--content--semantic--disabled--primary);
|
|
border-color: var(--c--contextuals--border--semantic--disabled--primary);
|
|
}
|
|
}
|
|
}
|
|
|
|
.c__button {
|
|
align-items: center;
|
|
border-radius: var(--c--components--button--border-radius);
|
|
border: thin solid transparent;
|
|
box-sizing: border-box;
|
|
cursor: pointer;
|
|
display: inline-flex;
|
|
// When button is rendered as link.
|
|
text-decoration: none;
|
|
font-weight: var(--c--components--button--font-weight);
|
|
font-family: var(--c--components--button--font-family);
|
|
transition: all var(--c--globals--transitions--duration)
|
|
var(--c--globals--transitions--ease-out);
|
|
user-select: none;
|
|
|
|
&__icon {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
&--text {
|
|
font-weight: var(--c--components--button--text-font-weight);
|
|
}
|
|
|
|
&--full-width {
|
|
width: 100%;
|
|
justify-content: center;
|
|
}
|
|
|
|
&--medium {
|
|
height: var(--c--components--button--medium-height);
|
|
font-size: var(--c--components--button--medium-font-size);
|
|
padding: 0 var(--c--globals--spacings--s);
|
|
|
|
|
|
&.c__button--icon-only {
|
|
width: var(--c--components--button--medium-height);
|
|
}
|
|
|
|
.c__button__icon,
|
|
.c__button__icon * {
|
|
font-size: var(--c--components--button--medium-icon-font-size);
|
|
}
|
|
}
|
|
|
|
&--small {
|
|
height: var(--c--components--button--small-height);
|
|
font-size: var(--c--components--button--small-font-size);
|
|
padding: 0 0.75rem;
|
|
|
|
&.c__button--icon-only {
|
|
width: var(--c--components--button--small-height);
|
|
}
|
|
|
|
.c__button__icon,
|
|
.c__button__icon * {
|
|
font-size: var(--c--components--button--small-icon-font-size);
|
|
}
|
|
}
|
|
|
|
&--nano {
|
|
height: var(--c--components--button--nano-height);
|
|
font-size: var(--c--components--button--nano-font-size);
|
|
padding: 0 0.5rem;
|
|
|
|
&.c__button--icon-only {
|
|
width: var(--c--components--button--nano-height);
|
|
}
|
|
|
|
.c__button__icon,
|
|
.c__button__icon * {
|
|
font-size: var(--c--components--button--nano-icon-font-size);
|
|
}
|
|
}
|
|
|
|
&--icon-only {
|
|
padding: 0;
|
|
justify-content: center;
|
|
}
|
|
|
|
&--with-icon--left,
|
|
&--with-icon--right {
|
|
gap: var(--c--globals--spacings--xxxs);
|
|
}
|
|
|
|
&--with-icon--left {
|
|
padding: 0 var(--c--globals--spacings--s) 0 var(--c--globals--spacings--t);
|
|
}
|
|
|
|
&--with-icon--right {
|
|
padding: 0 var(--c--globals--spacings--t) 0 var(--c--globals--spacings--s);
|
|
}
|
|
|
|
&--brand {
|
|
@include button-variant("brand");
|
|
}
|
|
&--neutral {
|
|
@include button-variant("neutral");
|
|
}
|
|
&--warning {
|
|
@include button-variant("warning");
|
|
}
|
|
&--error {
|
|
@include button-variant("error");
|
|
}
|
|
&--success {
|
|
@include button-variant("success");
|
|
}
|
|
&--info {
|
|
@include button-variant("info");
|
|
}
|
|
}
|