discourse/app/assets/stylesheets/common/components/buttons.scss

221 lines
3.6 KiB
SCSS

// --------------------------------------------------
// Buttons
// --------------------------------------------------
// Base
// --------------------------------------------------
.btn {
display: inline-block;
margin: 0;
padding: 6px 12px;
font-weight: 500;
font-size: $font-0;
line-height: $line-height-medium;
text-align: center;
cursor: pointer;
transition: all 0.25s;
&:active,
&.btn-active {
text-shadow: none;
}
&[disabled],
&.disabled {
cursor: default;
opacity: 0.4;
}
.fa {
margin-right: 7px;
}
&.no-text {
.fa {
margin-right: 0;
}
}
}
.btn.hidden {
display: none;
}
// Default button
// --------------------------------------------------
.btn {
border: none;
color: $primary;
font-weight: normal;
background: $primary-low;
&[href] {
color: $primary;
}
&:hover,
&.btn-hover {
background: $primary-medium;
color: $secondary;
}
&[disabled],
&.disabled {
background: $primary-low;
&:hover {
color: dark-light-choose($primary-low-mid, $secondary-high);
}
cursor: not-allowed;
}
.d-icon {
opacity: 0.7;
line-height: $line-height-medium; // Match button text line-height
}
&.btn-primary .d-icon {
opacity: 1;
}
}
// Primary button
// --------------------------------------------------
.btn-primary {
border: none;
font-weight: normal;
color: $secondary;
background: $tertiary;
&[href] {
color: $secondary;
}
&:hover,
&.btn-hover {
background: dark-light-choose(
scale-color($tertiary, $lightness: -20%),
scale-color($tertiary, $lightness: 20%)
);
}
&:active,
&.btn-active {
@include linear-gradient(
scale-color($tertiary, $lightness: -20%),
$tertiary
);
}
&[disabled],
&.disabled {
background: $tertiary;
}
}
// Danger button
// --------------------------------------------------
.btn-danger {
color: $secondary;
font-weight: normal;
background: $danger;
&[href] {
color: $secondary;
}
&:hover,
&.btn-hover {
background: dark-light-choose(
scale-color($danger, $lightness: -20%),
scale-color($danger, $lightness: 20%)
);
}
&:active,
&.btn-active {
@include linear-gradient(scale-color($danger, $lightness: -20%), $danger);
}
&[disabled],
&.disabled {
background: $danger;
}
}
// Social buttons
// --------------------------------------------------
.btn-social {
color: #fff;
&:hover {
color: #fff;
}
&[href] {
color: $secondary;
}
&:before {
margin-right: 9px;
font-family: FontAwesome;
font-size: $font-0;
}
&.google,
&.google_oauth2 {
background: $google;
&:before {
content: $fa-var-google;
}
}
&.instagram {
background: $instagram;
&:before {
content: $fa-var-instagram;
}
}
&.facebook {
background: $facebook;
&:before {
content: $fa-var-facebook;
}
}
&.cas {
background: $cas;
}
&.twitter {
background: $twitter;
&:before {
content: $fa-var-twitter;
}
}
&.yahoo {
background: $yahoo;
&:before {
content: $fa-var-yahoo;
}
}
&.github {
background: $github;
&:before {
content: $fa-var-github;
}
}
}
// Button Sizes
// --------------------------------------------------
// Small
.btn-small {
padding: 3px 6px;
font-size: $font-down-1;
}
// Large
.btn-large {
padding: 9px 18px;
font-size: $font-up-1;
line-height: $line-height-small;
}
.btn-flat {
background: transparent;
border: 0;
outline: 0;
line-height: $line-height-small;
.d-icon {
opacity: 0.7;
}
}