Ghost/ghost/admin/assets/sass/patterns/buttons.scss

213 lines
4.2 KiB
SCSS
Raw Normal View History

2014-08-04 19:11:22 +04:00
//
// Buttons
// --------------------------------------------------
// Base styles
// --------------------------------------------------
.btn {
display: inline-block;
margin-bottom: 0; // For input.btn
padding: 9px 14px;
font-size: 1.1rem;
line-height: 1.428571429;
font-weight: 300;
2014-08-04 19:11:22 +04:00
text-align: center;
text-transform: uppercase;
text-shadow: none;
letter-spacing: 1px;
2014-08-04 19:11:22 +04:00
vertical-align: middle;
cursor: pointer;
background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214
border: 1px solid transparent;
white-space: nowrap;
border-radius: $rounded;
2014-08-04 19:11:22 +04:00
@include user-select(none);
&,
&:active,
&.active {
&:focus {
@include tab-focus();
}
}
&:hover,
&:focus {
color: $blue;
2014-08-04 19:11:22 +04:00
text-decoration: none;
}
&:active,
&.active {
outline: 0;
background-image: none;
2014-08-04 20:24:41 +04:00
box-shadow: inset 0 2px 2px rgba(0,0,0,.125);
2014-08-04 19:11:22 +04:00
}
&.disabled,
&[disabled],
fieldset[disabled] & {
cursor: not-allowed;
pointer-events: none; // Future-proof disabling of clicks
opacity: 0.65;
box-shadow: none;
2014-08-04 19:11:22 +04:00
}
}
// Alternate buttons
// --------------------------------------------------
@mixin button-style($color, $background, $border) {
color: $color;
background-color: $background;
border-color: $border;
@include transition(background 0.2s ease, border-color 0.2s ease);
&:hover,
&:focus,
&:active,
&.active,
.open > &.dropdown-toggle {
color: $color;
background-color: darken($background, 10%);
border-color: darken($border, 12%);
}
&:active,
&.active,
.open > &.dropdown-toggle {
background-image: none;
}
&.disabled,
&[disabled],
fieldset[disabled] & {
&,
&:hover,
&:focus,
&:active,
&.active {
background-color: $background;
border-color: $border;
}
}
.badge {
color: $background;
background-color: $color;
2014-08-14 17:38:32 +04:00
box-shadow: 0 0 0 1px $color;
}
}
2014-08-04 19:11:22 +04:00
.btn-default {
font-weight: normal;
@include button-style(#666, #fff, lighten($midgrey, 40%));
2014-08-04 19:11:22 +04:00
}
.btn-alt {
@include button-style(#fff, #A1ADB3, darken(#A1ADB3, 5%));
}
.btn-blue {
@include button-style(#fff, $blue, darken($blue, 5%));
2014-08-04 19:11:22 +04:00
}
// Success appears as green
.btn-green {
@include button-style(#fff, $green, darken($green, 5%));
2014-08-04 19:11:22 +04:00
}
// Danger and error appear as red
.btn-red {
@include button-style(#fff, $red, darken($red, 5%));
2014-08-04 19:11:22 +04:00
}
// Link buttons
// -------------------------
// Make a button look and behave like a link
.btn-link {
color: $blue;
2014-08-04 19:11:22 +04:00
font-weight: normal;
cursor: pointer;
border-radius: 0;
&,
&:active,
&[disabled],
fieldset[disabled] & {
background-color: transparent;
box-shadow: none;
2014-08-04 19:11:22 +04:00
}
&,
&:hover,
&:focus,
&:active {
color: $blue;
2014-08-04 19:11:22 +04:00
border-color: transparent;
}
&:hover,
&:focus {
text-decoration: underline;
background-color: transparent;
}
&[disabled],
fieldset[disabled] & {
&:hover,
&:focus {
color: $midgrey;
2014-08-04 19:11:22 +04:00
text-decoration: none;
}
}
}
// Minor buttons
// -------------------------
// Add this class to buttons with a small/insignificant action
// for example a "cancel" button. Style is de-emphasised.
.btn-minor {
text-transform: none;
letter-spacing: 0;
font-size: 1.2rem;
padding: 8px 14px;
}
2014-08-04 19:11:22 +04:00
// Button Sizes
// --------------------------------------------------
.btn-lg {
padding: 12px 18px;
font-size: 1.4rem;
line-height: 1.33;
border-radius: 4px;
2014-08-04 19:11:22 +04:00
}
2014-08-04 19:11:22 +04:00
.btn-sm {
padding: 7px 10px;
font-size: 1rem;
line-height: 1.5;
border-radius: 2px;
2014-08-04 19:11:22 +04:00
}
// Block button
// --------------------------------------------------
.btn-block {
display: block;
width: 100%;
}
// Vertically space out multiple block buttons
.btn-block + .btn-block {
margin-top: 5px;
}
// Specificity overrides
input[type="submit"],
input[type="reset"],
input[type="button"] {
&.btn-block {
width: 100%;
}
2014-07-30 08:47:54 +04:00
}