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

200 lines
3.4 KiB
SCSS

// --------------------------------------------------
// Buttons
// --------------------------------------------------
// Base
// --------------------------------------------------
.btn {
display: inline-block;
margin: 0;
padding: 6px 12px;
font-weight: 500;
font-size: 1em;
line-height: 18px;
text-align: center;
cursor: pointer;
transition: all .25s;
&:active, &.btn-active {
text-shadow: none;
}
&[disabled], &.disabled {
cursor: default;
opacity: 0.4;
}
.fa {
margin-right: 7px;
}
&.no-text {
.fa {
margin-right: 0;
line-height: 10px;
}
}
}
.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;
}
&.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 {
color: #fff;
background: dark-light-choose($tertiary, $tertiary);
}
&:active, &.btn-active {
@include linear-gradient($tertiary, $tertiary);
color: $secondary;
}
&[disabled], &.disabled {
background: $tertiary;
}
}
// Danger button
// --------------------------------------------------
.btn-danger {
color: $secondary;
font-weight: normal;
background: $danger;
&[href] {
color: $secondary;
}
&:hover, &.btn-hover {
background: 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: $secondary;
text-shadow: 0 1px 0 rgba($primary, 0.2);
box-shadow: inset 0 1px 0 rgba(0,0,0, 0.1);
&[href] {
color: $secondary;
}
&:before {
margin-right: 9px;
font-family: FontAwesome;
font-size: 1.214em;
}
&.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: 0.857em;
line-height: 16px;
}
// Large
.btn-large {
padding: 9px 18px;
font-size: 1.143em;
line-height: 20px;
}
.btn-flat {
background: transparent;
border: 0;
outline: 0;
.d-icon {
opacity: 0.7;
}
}