mirror of https://github.com/rancher/dashboard.git
256 lines
5.1 KiB
SCSS
256 lines
5.1 KiB
SCSS
$btn-padding: 0 21px 0 21px;
|
|
$btn-sm-padding: 0 7px 0 7px;
|
|
$btn-height: 40px;
|
|
$btn-sm-height: 30px;
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// This file contains all styles related to the button component.
|
|
// -----------------------------------------------------------------------------
|
|
.btn,
|
|
button,
|
|
[class^='btn-'] {
|
|
align-items: center;
|
|
display: inline-flex;
|
|
text-align: center;
|
|
white-space: nowrap;
|
|
vertical-align: middle;
|
|
cursor: pointer;
|
|
-webkit-user-select: none;
|
|
-moz-user-select: none;
|
|
-ms-user-select: none;
|
|
user-select: none;
|
|
border: 0;
|
|
padding: $btn-padding;
|
|
border-radius: var(--border-radius);
|
|
color: var(--lightest);
|
|
line-height: $btn-height;
|
|
min-height: $btn-height;
|
|
|
|
> .icon:not(:only-child) {
|
|
margin-right: 6px;
|
|
}
|
|
|
|
&:hover {
|
|
text-decoration: none;
|
|
color: var(--lightest);
|
|
}
|
|
|
|
&.bg-transparent {
|
|
color: var(--body-text);
|
|
}
|
|
}
|
|
|
|
//icon button
|
|
.icon-btn {
|
|
padding: 0;
|
|
line-height: initial;
|
|
|
|
&.btn-sm {
|
|
padding: 0;
|
|
}
|
|
|
|
span {
|
|
padding: 0 10px 0 5px;
|
|
vertical-align: middle;
|
|
}
|
|
}
|
|
|
|
.btn-sm,
|
|
.btn-group-sm > .btn,
|
|
.btn-sm .btn-label {
|
|
padding: $btn-sm-padding;
|
|
min-height: $btn-sm-height;
|
|
line-height: 28px;
|
|
}
|
|
|
|
//btn roles
|
|
BUTTON.role-primary, A.role-primary {
|
|
background: var(--primary);
|
|
color: var(--primary-text);
|
|
|
|
&:hover, &._hover {
|
|
background-color: var(--primary-hover-bg);
|
|
color: var(--primary-text);
|
|
}
|
|
|
|
&:focus, &.focused {
|
|
background-color: var(--primary-hover-bg);
|
|
color: var(--primary-text);
|
|
}
|
|
|
|
&:focus-visible {
|
|
@include focus-outline;
|
|
outline-offset: 2px;
|
|
}
|
|
|
|
&.btn {
|
|
&:disabled {
|
|
background: var(--primary) !important;
|
|
color: var(--primary-text) !important;
|
|
opacity: 0.5;
|
|
}
|
|
}
|
|
}
|
|
|
|
.role-secondary {
|
|
background: var(--secondary, transparent);
|
|
color: var(--on-secondary, var(--primary)) !important;
|
|
border: solid 1px var(--secondary-border, var(--primary));
|
|
line-height: $btn-height - 2px;
|
|
|
|
&:hover, &._hover {
|
|
background: var(--secondary-hover, transparent);
|
|
color: var(--on-secondary, var(--lightest)) !important;
|
|
}
|
|
|
|
&:focus, &.focused {
|
|
background-color: var(--secondary-hover, var(--primary-hover-bg));
|
|
color: var(--on-secondary, var(--primary-text)) !important;
|
|
}
|
|
|
|
&.btn-sm {
|
|
line-height: $btn-sm-height - 2px;
|
|
|
|
&:focus, &.focused {
|
|
border: 0;
|
|
}
|
|
}
|
|
|
|
&:focus-visible {
|
|
@include focus-outline;
|
|
outline-offset: 2px;
|
|
}
|
|
}
|
|
|
|
.role-tertiary {
|
|
background: var(--tertiary, var(--accent-btn));
|
|
color: var(--on-tertiary, var(--primary));
|
|
|
|
&:hover {
|
|
background: var(--tertiary-hover);
|
|
color: var(--on-tertiary);
|
|
}
|
|
|
|
&:focus, &.focused {
|
|
background-color: var(--tertiary-hover, var(--primary-hover-bg));
|
|
color: var(--on-tertiary, var(--primary-text));
|
|
}
|
|
|
|
&.btn:not(.btn-sm) {
|
|
line-height: $btn-height - 2px;
|
|
}
|
|
|
|
&:focus-visible {
|
|
@include focus-outline;
|
|
outline-offset: 2px;
|
|
}
|
|
}
|
|
|
|
.role-link {
|
|
background: transparent;
|
|
color: var(--link);
|
|
|
|
&:hover, &._hover {
|
|
color: var(--lightest);
|
|
}
|
|
|
|
&:focus, &.focused {
|
|
background: transparent;
|
|
color: var(--link);
|
|
box-shadow: none;
|
|
}
|
|
|
|
&:focus-visible {
|
|
@include focus-outline;
|
|
outline-offset: 2px;
|
|
}
|
|
}
|
|
|
|
.role-multi-action {
|
|
background: var(--accent-btn);
|
|
border: solid thin var(--primary);
|
|
color: var(--primary);
|
|
border-radius: 2px;
|
|
}
|
|
|
|
.icon-group i {
|
|
font-size: 1.5em;
|
|
}
|
|
|
|
//disabled
|
|
.btn-disabled,
|
|
.btn.disabled,
|
|
.btn[disabled],
|
|
fieldset[disabled] .btn {
|
|
cursor: not-allowed;
|
|
color: var(--disabled-text) !important;
|
|
&:not(.role-link){
|
|
background-color: var(--disabled-bg) !important;
|
|
border-color: var(--disabled-bg) !important;
|
|
}
|
|
}
|
|
|
|
.btn-group {
|
|
position: relative;
|
|
text-align: initial;
|
|
vertical-align: middle;
|
|
padding: 0;
|
|
border-radius: var(--border-radius);
|
|
|
|
//TODO: Remove important specifier here and in bg-primary/bg-disabled
|
|
.bg-primary {
|
|
background: var(--toggle-on-bg, var(--primary));
|
|
color: var(--toggle-on-color, var(--primary-hover-text));
|
|
|
|
&:hover {
|
|
background: var(--active-hover) !important;
|
|
}
|
|
}
|
|
|
|
.bg-disabled {
|
|
background: var(--toggle-off-bg, var(--disabled-bg)) !important;
|
|
color: var(--toggle-off-color, var(--body-text));
|
|
|
|
&:hover {
|
|
background: var(--toggle-off-hover, var(--disabled-bg)) !important;
|
|
}
|
|
}
|
|
|
|
.btn {
|
|
position: relative;
|
|
display: inline-flex;
|
|
border-radius: 0;
|
|
text-align: center;
|
|
|
|
&:focus {
|
|
// Move the focused one to the top so that the focus ring is all visible
|
|
z-index: 1;
|
|
}
|
|
|
|
&:focus-visible {
|
|
z-index: 1;
|
|
@include focus-outline;
|
|
}
|
|
|
|
&.active {
|
|
@extend .bg-primary;
|
|
}
|
|
|
|
&:first-child {
|
|
border-top-left-radius: var(--border-radius);
|
|
border-bottom-left-radius: var(--border-radius);
|
|
}
|
|
|
|
&:last-child {
|
|
border-top-right-radius: var(--border-radius);
|
|
border-bottom-right-radius: var(--border-radius);
|
|
}
|
|
}
|
|
|
|
.btn-disabled,
|
|
.btn[disabled] {
|
|
// Ensure disabled button's border remains as-is, otherwise button appears vertically shorter than others in group
|
|
border: inherit;
|
|
}
|
|
}
|