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

278 lines
4.7 KiB
SCSS
Raw Normal View History

2013-02-06 03:16:51 +08:00
// --------------------------------------------------
// Buttons
// --------------------------------------------------
// Base
// --------------------------------------------------
.btn {
display: inline-block;
margin: 0;
padding: 6px 12px;
font-weight: 500;
2018-01-13 06:27:38 +08:00
font-size: $font-0;
line-height: $line-height-small;
2013-02-06 03:16:51 +08:00
text-align: center;
cursor: pointer;
transition: all 0.25s;
box-sizing: border-box;
2018-09-19 21:08:03 +08:00
min-height: 30px;
.d-icon {
transition: color 0.25s;
}
&:active,
&.btn-active {
2013-02-06 03:16:51 +08:00
text-shadow: none;
}
&[disabled],
&.disabled {
2013-02-06 03:16:51 +08:00
cursor: default;
opacity: 0.4;
}
.d-icon {
2013-02-06 03:16:51 +08:00
margin-right: 7px;
}
&.no-text {
.d-icon {
margin-right: 0;
}
}
2013-02-06 03:16:51 +08:00
}
.btn.hidden {
display: none;
}
2013-02-06 03:16:51 +08:00
// Default button
// --------------------------------------------------
.btn {
2013-10-29 00:25:52 +08:00
border: none;
color: $primary;
2013-10-29 00:25:52 +08:00
font-weight: normal;
background: $primary-low;
.d-icon {
color: $primary-high;
}
2013-02-06 03:16:51 +08:00
&[href] {
color: $primary;
min-height: unset; // ovverides button defaults
2013-02-06 03:16:51 +08:00
}
@include hover {
background: $primary-medium;
color: $secondary;
.d-icon {
color: $secondary-very-high;
}
2013-02-06 03:16:51 +08:00
}
&[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;
2013-02-06 03:16:51 +08:00
}
2017-05-12 02:47:08 +08:00
.d-icon {
line-height: $line-height-medium; // Match button text line-height
2017-05-12 02:47:08 +08:00
}
2013-02-06 03:16:51 +08:00
}
// Primary button
// --------------------------------------------------
.btn-primary {
2013-10-29 00:25:52 +08:00
border: none;
font-weight: normal;
2017-11-28 07:30:12 +08:00
color: $secondary;
2015-08-19 04:20:07 +08:00
background: $tertiary;
.d-icon {
color: currentColor;
}
2013-02-06 03:16:51 +08:00
&[href] {
color: $secondary;
2013-02-06 03:16:51 +08:00
}
@include hover {
background: dark-light-choose(
scale-color($tertiary, $lightness: -20%),
scale-color($tertiary, $lightness: 20%)
);
.d-icon {
color: currentColor;
}
2013-02-06 03:16:51 +08:00
}
&:active,
&.btn-active {
@include linear-gradient(
scale-color($tertiary, $lightness: -20%),
$tertiary
);
2013-02-06 03:16:51 +08:00
}
&[disabled],
&.disabled {
background: $tertiary;
.d-icon {
color: currentColor;
}
2013-02-06 03:16:51 +08:00
}
2013-02-14 15:56:13 +08:00
}
2013-02-14 15:56:13 +08:00
// Danger button
// --------------------------------------------------
2013-02-14 15:56:13 +08:00
.btn-danger {
color: $secondary;
font-weight: normal;
background: $danger;
.d-icon {
color: $danger-low;
}
2013-02-14 15:56:13 +08:00
&[href] {
color: $secondary;
2013-02-14 15:56:13 +08:00
}
@include hover {
background: dark-light-choose(
scale-color($danger, $lightness: -20%),
scale-color($danger, $lightness: 20%)
);
.d-icon {
color: $danger-low;
}
2013-02-14 15:56:13 +08:00
}
&:active,
&.btn-active {
@include linear-gradient(scale-color($danger, $lightness: -20%), $danger);
2013-02-14 15:56:13 +08:00
}
&[disabled],
&.disabled {
background: $danger;
.d-icon {
color: $danger-low;
}
2013-02-14 15:56:13 +08:00
}
2013-02-06 03:16:51 +08:00
}
// Social buttons
// --------------------------------------------------
.btn-social {
.d-icon {
color: #fff;
}
color: #fff;
background: #666;
&:hover {
color: #fff;
}
2013-02-06 03:16:51 +08:00
&[href] {
color: $secondary;
2013-02-06 03:16:51 +08:00
}
&:before {
margin-right: 9px;
font-size: $font-0;
2013-02-06 03:16:51 +08:00
}
&.google_oauth2 {
2013-02-06 03:16:51 +08:00
background: $google;
2018-10-25 10:11:19 +08:00
color: #333;
border: 1px solid $primary-low;
Upgrade to FontAwesome 5 (take two) (#6673) * Add missing icons to set * Revert FA5 revert This reverts commit 42572ff * use new SVG syntax in locales * Noscript page changes (remove login button, center "powered by" footer text) * Cast wider net for SVG icons in settings - include any _icon setting for SVG registry (offers better support for plugin settings) - let themes store multiple pipe-delimited icons in a setting - also replaces broken onebox image icon with SVG reference in cooked post processor * interpolate icons in locales * Fix composer whisper icon alignment * Add support for stacked icons * SECURITY: enforce hostname to match discourse hostname This ensures that the hostname rails uses for various helpers always matches the Discourse hostname * load SVG sprite with pre-initializers * FIX: enable caching on SVG sprites * PERF: use JSONP for SVG sprites so they are served from CDN This avoids needing to deal with CORS for loading of the SVG Note, added the svg- prefix to the filename so we can quickly tell in dev tools what the file is * Add missing SVG sprite JSONP script to CSP * Upgrade to FA 5.5.0 * Add support for all FA4.7 icons - adds complete frontend and backend for renamed FA4.7 icons - improves performance of SvgSprite.bundle and SvgSprite.all_icons * Fix group avatar flair preview - adds an endpoint at /svg-sprites/search/:keyword - adds frontend ajax call that pulls icon in avatar flair preview even when it is not in subset * Remove FA 4.7 font files
2018-11-27 05:49:57 +08:00
// non-FA SVG icon for Google in login-buttons.hbs
.d-icon {
opacity: 0.9;
2013-02-06 03:16:51 +08:00
}
&:hover {
color: currentColor;
background: darken($google, 5%);
}
2013-02-06 03:16:51 +08:00
}
2016-02-25 09:21:59 +08:00
&.instagram {
background: $instagram;
&:hover {
background: darken($instagram, 15%);
}
2016-02-25 09:21:59 +08:00
}
2013-02-06 03:16:51 +08:00
&.facebook {
background: $facebook;
&:hover {
background: darken($facebook, 15%);
}
2013-02-06 03:16:51 +08:00
}
2013-05-24 04:40:50 +08:00
&.cas {
background: $cas;
}
2013-02-06 03:16:51 +08:00
&.twitter {
background: $twitter;
&:hover {
background: darken($twitter, 10%);
}
2013-02-06 03:16:51 +08:00
}
&.github {
background: $github;
&:hover {
background: lighten($github, 20%);
}
}
&.discord {
background: $discord;
&:hover {
background: darken($discord, 10%);
}
}
2013-02-06 03:16:51 +08:00
}
// Button Sizes
// --------------------------------------------------
// Small
.btn-small {
padding: 3px 6px;
2018-01-13 06:27:38 +08:00
font-size: $font-down-1;
2013-02-06 03:16:51 +08:00
}
// Large
.btn-large {
padding: 9px 18px;
2018-01-13 06:27:38 +08:00
font-size: $font-up-1;
line-height: $line-height-small;
2013-02-14 15:56:13 +08:00
}
.btn-flat {
background: transparent;
border: 0;
outline: 0;
2018-01-13 06:27:38 +08:00
line-height: $line-height-small;
2019-02-01 03:06:32 +08:00
transition: color 0.25s, background 0.25s;
.d-icon {
color: $primary-low-mid;
}
@include hover {
.d-icon {
color: $primary;
}
}
&.close {
padding: 0;
min-height: unset;
background: transparent;
font-size: $font-up-3;
.d-icon {
color: $primary-high;
}
@include hover {
background: transparent;
2019-02-01 04:13:22 +08:00
.d-icon {
color: $primary;
}
}
}
}