discourse/app/assets/stylesheets/common/components/buttons.scss
David Taylor be96c4478e
FEATURE: Login with Discord (#8053)
This migrates the functionality of discourse-plugin-discord-auth into core. 

The plugin will automatically disable itself when core is updated: fd0867844d

For setup instructions, visit https://meta.discourse.org/t/configuring-discord-login-for-discourse/127129
2019-08-30 10:54:19 +01:00

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;
}
.d-icon {
margin-right: 7px;
}
&.no-text {
.d-icon {
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%);
}
}
&.github {
background: $github;
&:hover {
background: lighten($github, 20%);
}
}
&.discord {
background: $discord;
&:hover {
background: darken($discord, 10%);
}
}
}
// 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;
}
}
}
}