mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 21:35:48 +08:00
0d3531c2f1
Previously we relied on the provider name matching the name of the icon. Now icon names are explicitly set. Plugin providers which do not define an icon will get the default "sign-in-alt" icon
277 lines
4.8 KiB
SCSS
277 lines
4.8 KiB
SCSS
// --------------------------------------------------
|
|
// Buttons
|
|
// --------------------------------------------------
|
|
|
|
// Base
|
|
// --------------------------------------------------
|
|
|
|
.btn {
|
|
display: inline-block;
|
|
margin: 0;
|
|
padding: 6px 12px;
|
|
font-weight: 500;
|
|
font-size: $font-0;
|
|
line-height: $line-height-small;
|
|
text-align: center;
|
|
cursor: pointer;
|
|
transition: all 0.25s;
|
|
box-sizing: border-box;
|
|
min-height: 30px;
|
|
.d-icon {
|
|
transition: color 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;
|
|
.d-icon {
|
|
color: $primary-high;
|
|
}
|
|
|
|
&[href] {
|
|
color: $primary;
|
|
min-height: unset; // ovverides button defaults
|
|
}
|
|
.discourse-no-touch & {
|
|
// only allow hover on no-touch devices
|
|
&:hover,
|
|
&.btn-hover {
|
|
background: $primary-medium;
|
|
color: $secondary;
|
|
.d-icon {
|
|
color: $secondary-very-high;
|
|
}
|
|
}
|
|
}
|
|
&[disabled],
|
|
&.disabled {
|
|
background: $primary-low;
|
|
.d-icon {
|
|
color: $primary-medium;
|
|
}
|
|
&:hover {
|
|
color: dark-light-choose($primary-low-mid, $secondary-high);
|
|
.d-icon {
|
|
color: $primary-low-mid;
|
|
}
|
|
}
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
.d-icon {
|
|
line-height: $line-height-medium; // Match button text line-height
|
|
}
|
|
}
|
|
|
|
// Primary button
|
|
// --------------------------------------------------
|
|
|
|
.btn-primary {
|
|
border: none;
|
|
font-weight: normal;
|
|
color: $secondary;
|
|
background: $tertiary;
|
|
.d-icon {
|
|
color: currentColor;
|
|
}
|
|
&[href] {
|
|
color: $secondary;
|
|
}
|
|
.discourse-no-touch & {
|
|
// only allow hover on no-touch devices
|
|
&:hover,
|
|
&.btn-hover {
|
|
background: dark-light-choose(
|
|
scale-color($tertiary, $lightness: -20%),
|
|
scale-color($tertiary, $lightness: 20%)
|
|
);
|
|
.d-icon {
|
|
color: currentColor;
|
|
}
|
|
}
|
|
}
|
|
&:active,
|
|
&.btn-active {
|
|
@include linear-gradient(
|
|
scale-color($tertiary, $lightness: -20%),
|
|
$tertiary
|
|
);
|
|
}
|
|
&[disabled],
|
|
&.disabled {
|
|
background: $tertiary;
|
|
.d-icon {
|
|
color: currentColor;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Danger button
|
|
// --------------------------------------------------
|
|
|
|
.btn-danger {
|
|
color: $secondary;
|
|
font-weight: normal;
|
|
background: $danger;
|
|
.d-icon {
|
|
color: $danger-low;
|
|
}
|
|
&[href] {
|
|
color: $secondary;
|
|
}
|
|
.discourse-no-touch & {
|
|
// only allow hover on no-touch devices
|
|
&:hover,
|
|
&.btn-hover {
|
|
background: dark-light-choose(
|
|
scale-color($danger, $lightness: -20%),
|
|
scale-color($danger, $lightness: 20%)
|
|
);
|
|
.d-icon {
|
|
color: $danger-low;
|
|
}
|
|
}
|
|
}
|
|
&:active,
|
|
&.btn-active {
|
|
@include linear-gradient(scale-color($danger, $lightness: -20%), $danger);
|
|
}
|
|
&[disabled],
|
|
&.disabled {
|
|
background: $danger;
|
|
.d-icon {
|
|
color: $danger-low;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Social buttons
|
|
// --------------------------------------------------
|
|
|
|
.btn-social {
|
|
.d-icon {
|
|
color: #fff;
|
|
}
|
|
color: #fff;
|
|
background: #666;
|
|
&:hover {
|
|
color: #fff;
|
|
}
|
|
&[href] {
|
|
color: $secondary;
|
|
}
|
|
&:before {
|
|
margin-right: 9px;
|
|
font-size: $font-0;
|
|
}
|
|
&.google_oauth2 {
|
|
background: $google;
|
|
color: #333;
|
|
border: 1px solid $primary-low;
|
|
// non-FA SVG icon for Google in login-buttons.hbs
|
|
.d-icon {
|
|
opacity: 0.9;
|
|
}
|
|
&:hover {
|
|
color: currentColor;
|
|
background: darken($google, 5%);
|
|
}
|
|
}
|
|
&.instagram {
|
|
background: $instagram;
|
|
&:hover {
|
|
background: darken($instagram, 15%);
|
|
}
|
|
}
|
|
&.facebook {
|
|
background: $facebook;
|
|
&:hover {
|
|
background: darken($facebook, 15%);
|
|
}
|
|
}
|
|
&.cas {
|
|
background: $cas;
|
|
}
|
|
&.twitter {
|
|
background: $twitter;
|
|
&:hover {
|
|
background: darken($twitter, 10%);
|
|
}
|
|
}
|
|
&.yahoo {
|
|
background: $yahoo;
|
|
&:hover {
|
|
background: darken($yahoo, 10%);
|
|
}
|
|
}
|
|
&.github {
|
|
background: $github;
|
|
&:hover {
|
|
background: lighten($github, 20%);
|
|
}
|
|
}
|
|
}
|
|
|
|
// 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;
|
|
transition: color 0.25s, background 0.25s;
|
|
.d-icon {
|
|
color: $primary-low-mid;
|
|
}
|
|
.discourse-no-touch & {
|
|
&:hover {
|
|
.d-icon {
|
|
color: $primary;
|
|
}
|
|
}
|
|
}
|
|
}
|