Ghost/ghost/admin/assets/sass/patterns/buttons.scss
Paul Adam Davis 6af3991393 Update Patterns Sass Formatting
Continues on from #4342

- Reformats the Sass to match our new style (property order, comments, & white space)
2014-11-05 10:24:38 +00:00

241 lines
4.5 KiB
SCSS

// ------------------------------------------------------------
// Buttons
//
// Default button Styles, including sizes & colours
//
// * Default styles
// * Coloured buttons
// * Link buttons
// * Minor buttons
// * Button Sizes
// * Block button
// ------------------------------------------------------------
//
// Default styles
// --------------------------------------------------
.btn {
display: inline-block;
margin-bottom: 0;
padding: 9px 14px;
font-size: 1.1rem;
line-height: 1.428571429;
font-weight: 300;
text-align: center;
text-transform: uppercase;
text-shadow: none;
letter-spacing: 1px;
white-space: nowrap;
background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214
border: 1px solid transparent;
border-radius: $border-radius;
user-select: none;
cursor: pointer;
&,
&:active,
&.active {
&:focus {
@include tab-focus();
}
}
&:hover,
&:focus {
color: $blue;
text-decoration: none;
}
&:active,
&.active {
outline: 0;
background-image: none;
box-shadow: inset 0 2px 2px rgba(0,0,0,.125);
}
&.disabled,
&[disabled],
fieldset[disabled] & {
cursor: not-allowed;
pointer-events: none; // Future-proof disabling of clicks
opacity: 0.65;
box-shadow: none;
}
}//.btn
//
// Coloured buttons
// --------------------------------------------------
@mixin button-style($color, $background, $border) {
color: $color;
background-color: $background;
border-color: $border;
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;
box-shadow: 0 0 0 1px $color;
}
}//@mixin button-style
.btn-default {
font-weight: normal; // Increases the font-weight to make text more legible for white BG button
@include button-style(#666, #fff, lighten($midgrey, 40%));
}
.btn-alt {
@include button-style(#fff, #A1ADB3, darken(#A1ADB3, 5%));
}
.btn-blue {
@include button-style(#fff, $blue, darken($blue, 5%));
}
.btn-green {
@include button-style(#fff, $green, darken($green, 5%));
}
.btn-red {
@include button-style(#fff, $red, darken($red, 5%));
}
//
// Link buttons
// -------------------------
// Make a button look and behave like a link
.btn-link {
color: $blue;
font-weight: normal;
cursor: pointer;
border-radius: 0;
&,
&:active,
&[disabled],
fieldset[disabled] & {
background-color: transparent;
box-shadow: none;
}
&,
&:hover,
&:focus,
&:active {
color: $blue;
border-color: transparent;
}
&:hover,
&:focus {
text-decoration: underline;
background-color: transparent;
}
&[disabled],
fieldset[disabled] & {
&:hover,
&:focus {
color: $midgrey;
text-decoration: none;
}
}
}//.btn-link
//
// 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;
}
//
// Button Sizes
// --------------------------------------------------
.btn-lg {
padding: 12px 18px;
font-size: 1.4rem;
line-height: 1.33;
border-radius: 4px;
}
.btn-sm {
padding: 7px 10px;
font-size: 1rem;
line-height: 1.5;
border-radius: 2px;
}
//
// 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%;
}
}