The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/public/sass/components/_buttons.scss

292 lines
5.5 KiB

//
// Buttons
// --------------------------------------------------
// Base styles
// --------------------------------------------------
// Core
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
font-weight: $btn-font-weight;
line-height: $btn-line-height;
font-size: $font-size-base;
text-align: center;
vertical-align: middle;
cursor: pointer;
border: none;
height: $height-md;
@include button-size($btn-padding-y, $space-md, $font-size-base, $border-radius-sm);
&,
&:active,
&.active {
&:focus,
&.focus {
@include no-focus();
}
}
@include hover-focus {
text-decoration: none;
}
&.focus {
text-decoration: none;
}
&:active,
&.active {
background-image: none;
outline: 0;
}
&.disabled,
&[disabled],
&:disabled {
cursor: $cursor-disabled;
opacity: 0.65;
@include box-shadow(none);
pointer-events: none;
}
&--radius-left-0 {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
&--radius-right-0 {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
}
// Button Sizes
// --------------------------------------------------
// Large
.btn-large {
@include button-size($btn-padding-y-lg, $space-lg, $font-size-lg, $border-radius-sm);
font-weight: normal;
height: $height-lg;
.gicon {
//font-size: 31px;
margin-right: $space-sm;
filter: brightness(100);
}
}
.btn-small {
@include button-size($btn-padding-y-sm, $space-sm, $font-size-sm, $border-radius-sm);
height: $height-sm;
}
// Deprecated, only used by old plugins
.btn-mini {
@include button-size($btn-padding-y-sm, $space-sm, $font-size-sm, $border-radius-sm);
height: $height-sm;
}
.btn-link {
color: $btn-link-color;
background: transparent;
}
// Set the backgrounds
// -------------------------
.btn-success,
.btn-primary {
@include buttonBackground($btn-primary-bg, $btn-primary-bg-hl);
}
.btn-secondary {
@include buttonBackground($btn-secondary-bg, $btn-secondary-bg-hl);
}
// Danger and error appear as red
.btn-danger {
@include buttonBackground($btn-danger-bg, $btn-danger-bg-hl);
}
// Info appears as a neutral blue
.btn-secondary {
@include buttonBackground($btn-secondary-bg, $btn-secondary-bg-hl);
// Inverse appears as dark gray
}
.btn-inverse {
@include buttonBackground($btn-inverse-bg, $btn-inverse-bg-hl, $btn-inverse-text-color, $btn-inverse-text-shadow);
//background: $card-background;
box-shadow: $card-shadow;
//border: 1px solid $tight-form-func-highlight-bg;
}
.btn-transparent {
background-color: transparent;
}
.btn-outline-primary {
@include button-outline-variant($btn-primary-bg);
}
.btn-outline-secondary {
@include button-outline-variant($btn-secondary-bg-hl);
}
.btn-outline-inverse {
@include button-outline-variant($btn-inverse-bg);
}
.btn-outline-danger {
@include button-outline-variant($btn-danger-bg);
}
.btn-outline-disabled {
@include button-outline-variant($gray-1);
@include box-shadow(none);
cursor: default;
&:hover,
&:active,
&:active:hover,
&:focus {
color: $gray-1;
background-color: transparent;
border-color: $gray-1;
}
}
// Extra padding
.btn-p-x-2 {
padding-left: 20px;
padding-right: 20px;
}
// No horizontal padding
.btn-p-x-0 {
padding-left: 0;
padding-right: 0;
}
// External services
// Usage:
// <div class="btn btn-service btn-service--facebook">Button text</div>
$btn-service-icon-width: 35px;
.btn-service {
position: relative;
}
@each $service, $data in $external-services {
$serviceBgColor: map-get($data, bgColor);
$serviceBorderColor: map-get($data, borderColor);
.btn-service--#{$service} {
background-color: $serviceBgColor;
border: 1px solid $serviceBorderColor;
.btn-service-icon {
font-size: 24px; // Override
border-right: 1px solid $serviceBorderColor;
}
}
}
.btn-service-icon {
position: absolute;
left: 0;
height: 100%;
top: 0;
padding-left: $space-sm;
padding-right: $space-sm;
width: $btn-service-icon-width;
text-align: center;
&::before {
position: relative;
top: 4px;
}
}
.btn-service--grafanacom {
.btn-service-icon {
background-image: url(../img/grafana_mask_icon_white.svg);
background-repeat: no-repeat;
background-position: 50%;
background-size: 60%;
}
}
.btn-service--azuread {
.btn-service-icon {
background-image: url(../img/microsoft_auth_icon.svg);
background-repeat: no-repeat;
background-position: 50%;
background-size: 60%;
}
}
.btn-service--okta {
.btn-service-icon {
background-image: url(../img/okta_logo_white.png);
background-repeat: no-repeat;
background-position: 50%;
background-size: 60%;
}
}
//Toggle button
.toggle-btn {
background: $input-label-bg;
color: $text-color-weak;
box-shadow: $card-shadow;
&:first-child {
border-radius: 2px 0 0 2px;
margin: 0;
}
&:last-child {
border-radius: 0 2px 2px 0;
margin-left: 0 !important;
}
&.active {
background-color: lighten($input-label-bg, 5%);
color: $link-color;
&:hover {
cursor: default;
}
}
}
//Button animations
.btn-loading span {
animation-name: blink;
animation-duration: 1.4s;
animation-iteration-count: infinite;
animation-fill-mode: both;
}
.btn-loading span:nth-child(2) {
animation-delay: 0.2s;
}
.btn-loading span:nth-child(3) {
animation-delay: 0.4s;
}
@keyframes blink {
0% {
opacity: 0.2;
font-size: 14;
}
20% {
opacity: 1;
font-size: 18;
}
100% {
opacity: 0.2;
font-size: 14;
}
}