debian-mirror-gitlab/app/assets/stylesheets/framework/buttons.scss
2021-02-22 17:27:13 +05:30

511 lines
9 KiB
SCSS

@mixin btn-comment-icon {
border-radius: 50%;
background: $white;
padding: 1px;
font-size: 12px;
color: $blue-500;
border: 1px solid $blue-500;
width: 24px;
height: 24px;
&:hover,
&.inverted {
background: $blue-500;
border-color: $blue-600;
color: $white;
}
&:active {
outline: 0;
}
}
@mixin btn-default {
border-radius: $border-radius-default;
font-size: $gl-font-size;
font-weight: $gl-font-weight-normal;
padding: $gl-vert-padding $gl-btn-padding;
&:focus,
&:active {
background-color: $btn-active-gray;
box-shadow: none;
}
}
@mixin btn-middle {
@include btn-default;
}
@mixin btn-outline($background, $text, $border, $hover-background, $hover-text, $hover-border, $active-background, $active-border, $active-text) {
background-color: $background;
color: $text;
border-color: $border;
&.btn-border-color {
border-color: $border-color;
}
> .icon {
color: $text;
}
&:hover,
&:focus {
background-color: $hover-background;
border-color: $hover-border;
color: $hover-text;
> .icon {
color: $hover-text;
}
}
&:focus {
box-shadow: 0 0 4px 1px $blue-300;
}
&:active {
background-color: $active-background;
border-color: $active-border;
box-shadow: inset 0 2px 4px 0 rgba($black, 0.2);
color: $active-text;
> .icon {
color: $active-text;
}
&:focus {
box-shadow: inset 0 2px 4px 0 rgba($black, 0.2);
}
}
}
@mixin btn-color($light, $border-light, $normal, $border-normal, $dark, $border-dark, $color) {
background-color: $light;
border-color: $border-light;
color: $color;
&:hover,
&:focus {
background-color: $normal;
border-color: $border-normal;
color: $color;
}
&:active,
&.active {
box-shadow: $gl-btn-active-background;
background-color: $dark;
border-color: $border-dark;
color: $color;
}
}
@mixin btn-green {
@include btn-color($green-500, $green-600, $green-600, $green-700, $green-700, $green-800, $white);
}
@mixin btn-blue {
@include btn-color($blue-500, $blue-600, $blue-600, $blue-700, $blue-700, $blue-800, $white);
}
@mixin btn-orange {
@include btn-color($orange-500, $orange-600, $orange-500, $orange-600, $orange-600, $orange-800, $white);
}
@mixin btn-red {
@include btn-color($red-500, $red-600, $red-600, $red-700, $red-700, $red-800, $white);
}
@mixin btn-white {
@include btn-color($white, $border-color, $white-normal, $border-white-normal, $white-dark, $border-white-normal, $gl-text-color);
}
@mixin btn-with-margin {
margin-left: $btn-side-margin;
float: left;
&.inline {
float: none;
}
&.btn-sm {
margin-left: $btn-sm-side-margin;
}
}
@mixin btn-svg {
height: $gl-padding;
width: $gl-padding;
top: 0;
vertical-align: text-top;
}
.btn {
@include btn-default;
@include btn-white;
color: $gl-text-color;
white-space: nowrap;
&:focus:active {
outline: 0;
}
&.btn-sm {
padding: 4px 10px;
font-size: $gl-btn-small-font-size;
line-height: $gl-btn-small-line-height;
}
&.btn-xs {
padding: 2px $gl-btn-padding;
font-size: $gl-btn-xs-font-size;
line-height: $gl-btn-xs-line-height;
}
&.btn-success {
@include btn-green;
}
&.btn-inverted:not(.disabled):not(:disabled) {
&.btn-success {
@include btn-outline($white, $green-600, $green-500, $green-100, $green-700, $green-500, $green-200, $green-600, $green-800);
}
&.btn-danger {
@include btn-outline($white, $red-500, $red-500, $red-100, $red-700, $red-500, $red-200, $red-600, $red-800);
}
&.btn-warning {
@include btn-outline($white, $orange-500, $orange-500, $orange-50, $orange-600, $orange-600, $orange-100, $orange-700, $orange-700);
}
&.btn-primary,
&.btn-info {
@include btn-outline($white, $blue-500, $blue-500, $blue-100, $blue-700, $blue-500, $blue-200, $blue-600, $blue-800);
}
}
&.btn-info,
&.btn-primary {
@include btn-blue;
}
&.btn-warning {
@include btn-orange;
}
&.btn-close {
@include btn-outline($white, $orange-500, $orange-500, $orange-50, $orange-600, $orange-600, $orange-100, $orange-700, $orange-700);
}
&.btn-danger {
@include btn-red;
}
&.btn-cancel {
float: right;
}
&.btn-grouped {
@include btn-with-margin;
}
&.btn-icon {
color: $gray-700;
}
&.btn-text-field {
width: 100%;
text-align: left;
padding: 6px 16px;
border-color: $border-color;
color: $gray-darkest;
background-color: $white;
&:hover,
&:active,
&:focus {
cursor: text;
box-shadow: none;
border-color: lighten($blue-300, 20%);
color: $gray-darkest;
}
}
&.dot-highlight::after {
content: '';
background-color: $blue-500;
width: $gl-padding * 0.5;
height: $gl-padding * 0.5;
display: inline-block;
border-radius: 50%;
margin-left: 3px;
}
svg {
height: 15px;
width: 15px;
}
svg:not(:last-child) {
margin-right: 5px;
}
}
.btn-terminal {
svg {
height: 14px;
width: $default-icon-size;
}
}
.btn-lg {
padding: 12px 20px;
}
.btn-transparent {
color: $gl-text-color-secondary;
background-color: transparent;
border: 0;
&:hover,
&:active,
&:focus {
background-color: transparent;
box-shadow: none;
}
}
.btn-block {
width: 100%;
margin: 0;
margin-bottom: 15px;
&.btn {
padding: 6px 0;
}
}
.btn-align-content {
display: flex;
justify-content: center;
align-items: center;
}
.btn-group {
&.btn-grouped {
@include btn-with-margin;
}
}
.btn-clipboard {
border: 0;
padding: 0 5px;
svg {
top: auto;
width: 16px;
height: 16px;
}
}
.input-group-prepend,
.input-group-append {
.btn {
@include btn-middle;
&:hover {
outline: none;
}
&:active {
outline: none;
}
&.btn-clipboard {
padding-left: 15px;
padding-right: 15px;
}
}
.active {
box-shadow: $gl-btn-active-background;
border: 1px solid $border-white-normal !important;
background-color: $btn-active-gray-light !important;
}
}
.btn-loading {
&:not(.disabled) {
.spinner {
display: none;
}
}
}
.btn-build {
margin-left: 10px;
svg {
fill: $gl-text-color-secondary;
}
}
.clone-dropdown-btn a {
color: $gray-700;
&:hover {
text-decoration: none;
}
}
.btn-static {
background-color: $gray-light !important;
border: 1px solid $border-gray-normal;
cursor: default;
&:active {
box-shadow: inset 0 0 0 $white;
}
}
.btn-inverted {
&-secondary {
@include btn-outline($white, $blue-500, $blue-500, $blue-100, $blue-700, $blue-500, $blue-200, $blue-600, $blue-800);
}
}
.btn-blank {
padding: 0;
background: transparent;
border: 0;
border-radius: 0;
&:hover,
&:active,
&:focus {
outline: 0;
background: transparent;
box-shadow: none;
}
}
.btn-link {
padding: 0;
background-color: transparent;
color: $blue-600;
font-weight: normal;
border-radius: 0;
border-color: transparent;
border-width: 0;
&:hover,
&:active,
&:focus {
color: $blue-800;
text-decoration: underline;
background-color: transparent;
border-color: transparent;
}
&.btn-secondary-hover-link,
&.btn-default-hover-link {
color: $gl-text-color-secondary;
&:hover,
&:active,
&:focus {
color: $blue-600;
text-decoration: none;
}
}
&.btn-primary-hover-link {
color: inherit;
&:hover,
&:active,
&:focus {
color: $blue-600;
text-decoration: none;
}
}
}
.btn-missing {
color: $gl-text-color-secondary;
border: 1px dashed $border-gray-normal-dashed;
border-radius: $border-radius-default;
&:hover,
&:active,
&:focus {
color: $gl-text-color-secondary;
background-color: $white-normal;
}
}
// The .btn-svg class is available for legacy icon buttons to
// preserve a 34px height and have 16x16 icons at the same time.
// Once a button is migrated (to the current 32px height)
// please remove this class from the new button.
.btn-svg svg {
@include btn-svg;
}
// All disabled buttons, regardless of color, type, etc
%disabled {
background-color: $gray-light;
border-color: $gray-100;
color: $gl-text-color-disabled;
opacity: 1;
text-decoration: none;
cursor: default;
&.cursor-not-allowed {
cursor: not-allowed;
}
i {
color: $gl-text-color-disabled;
}
}
.btn.disabled,
.btn[disabled],
fieldset[disabled] .btn,
.dropdown-toggle[disabled],
[disabled].dropdown-menu-toggle {
@extend %disabled;
&:hover {
@extend %disabled;
}
&.btn-link {
background-color: transparent;
}
}
[readonly] {
cursor: default;
}
.btn-no-padding {
padding: 0;
}
// This class helps convert `.gl-button` children so that they consistently
// match the style of `.btn` elements which might be around them. Ideally we
// wouldn't need this class.
//
// Remove by upgrading all buttons in a container to use the new `.gl-button` style.
.gl-button-deprecated-adapter .gl-button {
box-shadow: none;
border-width: 1px;
}