2013-02-06 03:16:51 +08:00
|
|
|
// --------------------------------------------------
|
|
|
|
// Buttons
|
|
|
|
// --------------------------------------------------
|
|
|
|
|
|
|
|
// Base
|
|
|
|
// --------------------------------------------------
|
|
|
|
|
2019-12-14 03:09:48 +08:00
|
|
|
@mixin btn(
|
2020-08-04 10:57:10 +08:00
|
|
|
$text-color: var(--primary),
|
|
|
|
$bg-color: var(--primary-low),
|
|
|
|
$icon-color: var(--primary-high),
|
|
|
|
$hover-text-color: var(--secondary),
|
|
|
|
$hover-bg-color: var(--primary-medium),
|
|
|
|
$hover-icon-color: var(--primary-low)
|
2019-12-14 03:09:48 +08:00
|
|
|
) {
|
2021-09-09 23:01:56 +08:00
|
|
|
@include form-item-sizing;
|
2021-01-28 05:17:08 +08:00
|
|
|
display: inline-flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
2013-02-06 03:16:51 +08:00
|
|
|
margin: 0;
|
2019-12-14 03:09:48 +08:00
|
|
|
font-weight: normal;
|
|
|
|
color: $text-color;
|
2023-05-23 05:03:34 +08:00
|
|
|
background-color: $bg-color;
|
|
|
|
background-image: linear-gradient(
|
|
|
|
to bottom,
|
|
|
|
rgba(0, 0, 0, 0),
|
|
|
|
rgba(0, 0, 0, 0)
|
|
|
|
);
|
2022-11-17 00:35:09 +08:00
|
|
|
border-radius: var(--d-button-border-radius);
|
2023-06-16 22:25:58 +08:00
|
|
|
transition: background 0.25s, color 0.25s;
|
2013-02-06 03:16:51 +08:00
|
|
|
cursor: pointer;
|
2019-02-01 02:59:49 +08:00
|
|
|
.d-icon {
|
2019-12-14 03:09:48 +08:00
|
|
|
color: $icon-color;
|
|
|
|
margin-right: 0.45em;
|
2019-02-01 02:59:49 +08:00
|
|
|
transition: color 0.25s;
|
2022-10-17 22:07:46 +08:00
|
|
|
// For Windows High Contrast (see whcm.scss for more)
|
|
|
|
@media (forced-colors: active) {
|
|
|
|
color: ButtonText;
|
|
|
|
}
|
2021-10-19 01:17:27 +08:00
|
|
|
}
|
|
|
|
.d-button-label + .d-icon {
|
|
|
|
margin-left: 0.45em;
|
|
|
|
margin-right: 0;
|
2013-02-06 03:16:51 +08:00
|
|
|
}
|
2013-05-08 02:25:41 +08:00
|
|
|
&.no-text {
|
2019-07-22 22:31:21 +08:00
|
|
|
.d-icon {
|
2013-05-08 02:25:41 +08:00
|
|
|
margin-right: 0;
|
|
|
|
}
|
|
|
|
}
|
2019-10-29 04:04:29 +08:00
|
|
|
@include hover {
|
2023-05-23 05:03:34 +08:00
|
|
|
background-color: $hover-bg-color;
|
2019-12-14 03:09:48 +08:00
|
|
|
color: $hover-text-color;
|
2019-10-29 04:04:29 +08:00
|
|
|
.d-icon {
|
2019-12-14 03:09:48 +08:00
|
|
|
color: $hover-icon-color;
|
2022-10-17 22:07:46 +08:00
|
|
|
// For Windows High Contrast (see whcm.scss for more)
|
|
|
|
@media (forced-colors: active) {
|
|
|
|
color: Highlight;
|
|
|
|
}
|
2018-10-05 05:15:37 +08:00
|
|
|
}
|
2013-02-06 03:16:51 +08:00
|
|
|
}
|
2021-02-04 00:45:54 +08:00
|
|
|
&:focus {
|
|
|
|
outline: none;
|
2023-05-23 05:03:34 +08:00
|
|
|
background-color: $hover-bg-color;
|
2021-02-04 00:45:54 +08:00
|
|
|
color: $hover-text-color;
|
|
|
|
.d-icon {
|
|
|
|
color: $hover-icon-color;
|
2022-10-17 22:07:46 +08:00
|
|
|
@media (forced-colors: active) {
|
|
|
|
color: Highlight;
|
|
|
|
}
|
2021-02-04 00:45:54 +08:00
|
|
|
}
|
2023-08-08 04:46:10 +08:00
|
|
|
|
|
|
|
&:focus-visible {
|
|
|
|
@include darken-background($hover-bg-color, 0.1);
|
|
|
|
}
|
2021-02-04 00:45:54 +08:00
|
|
|
}
|
2019-12-14 03:09:48 +08:00
|
|
|
&[href] {
|
|
|
|
color: $text-color;
|
2023-09-08 05:51:34 +08:00
|
|
|
&:focus {
|
|
|
|
color: $hover-text-color;
|
|
|
|
}
|
2019-12-14 03:09:48 +08:00
|
|
|
}
|
2023-05-23 05:03:34 +08:00
|
|
|
.discourse-no-touch &:active:not(:hover):not(:focus),
|
|
|
|
.discourse-no-touch &.btn-active:not(:hover):not(:focus),
|
|
|
|
&:active:not(:hover):not(:focus),
|
|
|
|
&.btn-active:not(:hover):not(:focus) {
|
|
|
|
@include darken-background($bg-color, 0.6);
|
|
|
|
color: $hover-text-color;
|
|
|
|
.d-icon {
|
|
|
|
color: $hover-icon-color;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.discourse-no-touch &:active,
|
|
|
|
.discourse-no-touch &.btn-active,
|
2019-12-14 03:09:48 +08:00
|
|
|
&:active,
|
|
|
|
&.btn-active {
|
2023-05-23 05:03:34 +08:00
|
|
|
@include darken-background($bg-color, 0.3);
|
|
|
|
color: $hover-text-color;
|
|
|
|
.d-icon {
|
|
|
|
color: $hover-icon-color;
|
|
|
|
}
|
2019-12-14 03:09:48 +08:00
|
|
|
}
|
2018-06-08 17:49:31 +08:00
|
|
|
&[disabled],
|
|
|
|
&.disabled {
|
2021-09-17 21:36:57 +08:00
|
|
|
&:not(.is-loading) {
|
|
|
|
opacity: 0.4;
|
|
|
|
}
|
2018-06-08 17:49:31 +08:00
|
|
|
&:hover {
|
2019-12-14 03:09:48 +08:00
|
|
|
color: $text-color;
|
|
|
|
background: $bg-color;
|
2019-02-01 02:59:49 +08:00
|
|
|
.d-icon {
|
2019-12-14 03:09:48 +08:00
|
|
|
color: $icon-color;
|
2019-02-01 02:59:49 +08:00
|
|
|
}
|
2018-06-08 17:49:31 +08:00
|
|
|
}
|
2014-02-13 12:06:49 +08:00
|
|
|
cursor: not-allowed;
|
2013-02-06 03:16:51 +08:00
|
|
|
}
|
2020-03-31 05:17:00 +08:00
|
|
|
|
|
|
|
.loading-container {
|
|
|
|
display: none;
|
|
|
|
margin: 0 6.75px 0 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
&.is-loading {
|
|
|
|
&.btn-text {
|
|
|
|
.d-button-label {
|
2022-10-12 21:31:59 +08:00
|
|
|
font-size: var(--font-down-2);
|
2020-03-31 05:17:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
&.btn-small {
|
|
|
|
.loading-icon {
|
2022-10-12 21:31:59 +08:00
|
|
|
font-size: var(--font-down-1);
|
2020-03-31 05:17:00 +08:00
|
|
|
margin-right: 0.2em;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.loading-icon {
|
|
|
|
animation: rotate-forever 1s infinite linear, fadein 1s;
|
|
|
|
}
|
|
|
|
}
|
2019-12-14 03:09:48 +08:00
|
|
|
}
|
2017-05-12 02:47:08 +08:00
|
|
|
|
2019-12-14 03:09:48 +08:00
|
|
|
.btn.hidden {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Default button
|
|
|
|
// --------------------------------------------------
|
|
|
|
|
|
|
|
.btn {
|
|
|
|
@include btn;
|
2013-02-06 03:16:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Primary button
|
|
|
|
// --------------------------------------------------
|
|
|
|
|
|
|
|
.btn-primary {
|
2019-12-14 03:09:48 +08:00
|
|
|
@include btn(
|
2020-08-04 10:57:10 +08:00
|
|
|
$text-color: var(--secondary),
|
|
|
|
$bg-color: var(--tertiary),
|
|
|
|
$icon-color: var(--secondary),
|
|
|
|
$hover-bg-color: var(--tertiary-hover),
|
|
|
|
$hover-icon-color: var(--secondary)
|
2019-12-14 03:09:48 +08:00
|
|
|
);
|
2013-02-14 15:56:13 +08:00
|
|
|
}
|
2013-02-14 15:47:19 +08:00
|
|
|
|
2013-02-14 15:56:13 +08:00
|
|
|
// Danger button
|
|
|
|
// --------------------------------------------------
|
2013-02-14 15:47:19 +08:00
|
|
|
|
2013-02-14 15:56:13 +08:00
|
|
|
.btn-danger {
|
2019-12-14 03:09:48 +08:00
|
|
|
@include btn(
|
2020-08-04 10:57:10 +08:00
|
|
|
$text-color: var(--secondary),
|
|
|
|
$bg-color: var(--danger),
|
|
|
|
$icon-color: var(--danger-low),
|
|
|
|
$hover-bg-color: var(--danger-hover),
|
|
|
|
$hover-icon-color: var(--danger-low)
|
2019-12-14 03:09:48 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ✘ and ✔ buttons
|
|
|
|
// --------------------------------------------------
|
|
|
|
|
|
|
|
.btn.cancel {
|
|
|
|
@include btn(
|
2020-08-04 10:57:10 +08:00
|
|
|
$text-color: var(--secondary),
|
|
|
|
$bg-color: var(--danger),
|
|
|
|
$icon-color: var(--secondary),
|
|
|
|
$hover-bg-color: var(--danger-hover),
|
|
|
|
$hover-icon-color: var(--secondary)
|
2019-12-14 03:09:48 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
.btn.ok {
|
|
|
|
@include btn(
|
2020-08-04 10:57:10 +08:00
|
|
|
$text-color: var(--secondary),
|
|
|
|
$bg-color: var(--success),
|
|
|
|
$icon-color: var(--secondary),
|
|
|
|
$hover-bg-color: var(--success-hover),
|
|
|
|
$hover-icon-color: var(--secondary)
|
2019-12-14 03:09:48 +08:00
|
|
|
);
|
2013-02-06 03:16:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Social buttons
|
|
|
|
// --------------------------------------------------
|
|
|
|
|
2021-03-31 02:16:50 +08:00
|
|
|
.btn-social {
|
2021-02-11 04:53:18 +08:00
|
|
|
color: #000;
|
2021-03-31 02:16:50 +08:00
|
|
|
background: #fff;
|
2021-02-11 04:53:18 +08:00
|
|
|
border: 1px solid transparent;
|
2022-11-17 00:35:09 +08:00
|
|
|
border-radius: var(--d-border-radius);
|
2021-03-31 02:16:50 +08:00
|
|
|
&:hover,
|
|
|
|
&:focus {
|
2023-06-14 04:38:31 +08:00
|
|
|
box-shadow: var(--shadow-card);
|
2021-03-31 02:16:50 +08:00
|
|
|
outline: 1px solid #000;
|
2018-01-23 10:19:38 +08:00
|
|
|
}
|
2013-02-06 03:16:51 +08:00
|
|
|
&[href] {
|
2020-08-04 10:57:10 +08:00
|
|
|
color: var(--secondary);
|
2013-02-06 03:16:51 +08:00
|
|
|
}
|
|
|
|
&:before {
|
2015-07-21 13:46:33 +08:00
|
|
|
margin-right: 9px;
|
2022-10-12 21:31:59 +08:00
|
|
|
font-size: var(--font-0);
|
2013-02-06 03:16:51 +08:00
|
|
|
}
|
2021-08-03 19:48:21 +08:00
|
|
|
.d-icon,
|
|
|
|
&.btn:hover .d-icon {
|
|
|
|
color: #000;
|
|
|
|
}
|
2018-06-08 17:49:31 +08:00
|
|
|
&.google_oauth2 {
|
2020-08-04 10:57:10 +08:00
|
|
|
background: var(--google);
|
2018-10-25 10:11:19 +08:00
|
|
|
color: #333;
|
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
|
|
|
}
|
2021-02-04 00:45:54 +08:00
|
|
|
&:hover,
|
|
|
|
&:focus {
|
2019-03-16 05:20:52 +08:00
|
|
|
color: currentColor;
|
|
|
|
}
|
2013-02-06 03:16:51 +08:00
|
|
|
}
|
2021-02-11 04:53:18 +08:00
|
|
|
|
2013-05-24 04:40:50 +08:00
|
|
|
&.cas {
|
2021-02-11 04:53:18 +08:00
|
|
|
.d-icon {
|
|
|
|
color: var(--cas);
|
|
|
|
}
|
|
|
|
&:hover {
|
|
|
|
.d-icon {
|
|
|
|
color: var(--cas);
|
|
|
|
}
|
|
|
|
}
|
2013-05-24 04:40:50 +08:00
|
|
|
}
|
2013-02-06 03:16:51 +08:00
|
|
|
&.twitter {
|
2021-02-11 04:53:18 +08:00
|
|
|
.d-icon {
|
|
|
|
color: var(--twitter);
|
|
|
|
}
|
|
|
|
&:hover {
|
|
|
|
.d-icon {
|
|
|
|
color: var(--twitter);
|
|
|
|
}
|
2019-03-16 05:20:52 +08:00
|
|
|
}
|
2013-02-06 03:16:51 +08:00
|
|
|
}
|
2013-02-26 12:28:32 +08:00
|
|
|
&.github {
|
2021-02-11 04:53:18 +08:00
|
|
|
.d-icon {
|
|
|
|
color: var(--github);
|
|
|
|
}
|
|
|
|
&:hover {
|
|
|
|
.d-icon {
|
|
|
|
color: var(--github);
|
|
|
|
}
|
2019-03-16 05:20:52 +08:00
|
|
|
}
|
2013-02-26 12:28:32 +08:00
|
|
|
}
|
2019-08-30 17:54:19 +08:00
|
|
|
&.discord {
|
2021-02-11 04:53:18 +08:00
|
|
|
.d-icon {
|
|
|
|
color: var(--discord);
|
|
|
|
}
|
|
|
|
&:hover {
|
|
|
|
.d-icon {
|
|
|
|
color: var(--discord);
|
|
|
|
}
|
2019-08-30 17:54:19 +08:00
|
|
|
}
|
|
|
|
}
|
2013-02-06 03:16:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Button Sizes
|
|
|
|
// --------------------------------------------------
|
|
|
|
|
|
|
|
// Small
|
|
|
|
|
|
|
|
.btn-small {
|
2021-09-09 23:01:56 +08:00
|
|
|
font-size: var(--font-down-1);
|
2020-02-20 01:38:46 +08:00
|
|
|
min-height: 20px;
|
2013-02-06 03:16:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Large
|
|
|
|
|
|
|
|
.btn-large {
|
2021-09-09 23:01:56 +08:00
|
|
|
font-size: var(--font-up-1);
|
2013-02-14 15:56:13 +08:00
|
|
|
}
|
2017-07-25 05:31:14 +08:00
|
|
|
|
2021-04-08 04:15:07 +08:00
|
|
|
// Bonus Buttons
|
|
|
|
// --------------------------------------------------
|
|
|
|
|
2017-07-25 05:31:14 +08:00
|
|
|
.btn-flat {
|
|
|
|
background: transparent;
|
|
|
|
border: 0;
|
2022-10-12 22:05:42 +08:00
|
|
|
line-height: var(--line-height-small);
|
2023-06-16 22:25:58 +08:00
|
|
|
transition: background 0.25s, color 0.25s;
|
2017-07-28 03:03:41 +08:00
|
|
|
.d-icon {
|
2020-08-04 10:57:10 +08:00
|
|
|
color: var(--primary-low-mid);
|
2023-06-16 22:25:58 +08:00
|
|
|
transition: color 0.25s;
|
2019-02-01 02:59:49 +08:00
|
|
|
}
|
2019-10-29 04:04:29 +08:00
|
|
|
@include hover {
|
2022-02-18 00:10:08 +08:00
|
|
|
background: transparent;
|
|
|
|
color: var(--primary);
|
2019-10-29 04:04:29 +08:00
|
|
|
.d-icon {
|
2020-08-04 10:57:10 +08:00
|
|
|
color: var(--primary);
|
2019-10-29 04:04:29 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
&.close {
|
|
|
|
padding: 0;
|
|
|
|
background: transparent;
|
2021-09-09 23:01:56 +08:00
|
|
|
font-size: var(--font-up-3);
|
2019-10-29 04:04:29 +08:00
|
|
|
.d-icon {
|
2020-08-04 10:57:10 +08:00
|
|
|
color: var(--primary-high);
|
2019-10-29 04:04:29 +08:00
|
|
|
}
|
|
|
|
@include hover {
|
|
|
|
background: transparent;
|
2019-02-01 04:13:22 +08:00
|
|
|
.d-icon {
|
2020-08-04 10:57:10 +08:00
|
|
|
color: var(--primary);
|
2019-02-01 04:13:22 +08:00
|
|
|
}
|
2019-02-01 02:59:49 +08:00
|
|
|
}
|
2017-07-25 23:37:32 +08:00
|
|
|
}
|
2022-08-16 03:06:03 +08:00
|
|
|
&.btn-text {
|
|
|
|
color: var(--tertiary);
|
|
|
|
&[disabled] {
|
|
|
|
&,
|
|
|
|
&:hover,
|
|
|
|
&.btn-hover,
|
|
|
|
&:focus {
|
|
|
|
color: var(--primary);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
&:not([disabled]) {
|
|
|
|
&:hover,
|
|
|
|
&.btn-hover,
|
|
|
|
&:focus {
|
|
|
|
color: var(--tertiary-hover);
|
|
|
|
}
|
2021-03-18 20:29:27 +08:00
|
|
|
|
2022-08-16 03:06:03 +08:00
|
|
|
&:active,
|
|
|
|
&.btn-active {
|
2023-05-23 05:03:34 +08:00
|
|
|
@include darken-background(transparent, 0.2);
|
2022-08-16 03:06:03 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-03-18 20:29:27 +08:00
|
|
|
&:focus {
|
|
|
|
outline: none;
|
2021-05-24 16:10:01 +08:00
|
|
|
background: var(--primary-low);
|
2021-03-18 20:29:27 +08:00
|
|
|
.d-icon {
|
2021-05-24 16:10:01 +08:00
|
|
|
color: var(--primary);
|
2021-03-18 20:29:27 +08:00
|
|
|
}
|
|
|
|
}
|
2017-07-25 05:31:14 +08:00
|
|
|
}
|
2019-11-01 03:36:24 +08:00
|
|
|
|
|
|
|
.btn-link {
|
|
|
|
background: transparent;
|
|
|
|
border: 0;
|
|
|
|
padding: 0;
|
2020-08-04 10:57:10 +08:00
|
|
|
color: var(--tertiary);
|
2022-12-20 07:56:51 +08:00
|
|
|
.discourse-no-touch & {
|
|
|
|
&:hover {
|
|
|
|
color: var(--tertiary);
|
|
|
|
background: transparent;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
&:focus {
|
|
|
|
color: var(--tertiary);
|
|
|
|
background: transparent;
|
|
|
|
}
|
|
|
|
&:focus-visible {
|
|
|
|
color: var(--tertiary);
|
|
|
|
background: transparent;
|
|
|
|
@include default-focus;
|
|
|
|
}
|
2019-11-01 03:36:24 +08:00
|
|
|
}
|
2021-04-08 04:15:07 +08:00
|
|
|
|
|
|
|
.btn-mini-toggle {
|
2022-11-17 00:35:09 +08:00
|
|
|
border-radius: var(--d-border-radius);
|
2021-04-08 04:15:07 +08:00
|
|
|
padding: 0.4em 0.467em;
|
|
|
|
.d-icon {
|
|
|
|
color: var(--primary-high);
|
|
|
|
}
|
|
|
|
@include hover {
|
|
|
|
background: transparent;
|
|
|
|
.d-icon {
|
|
|
|
color: var(--primary);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
&:focus {
|
|
|
|
background: var(--primary-low);
|
|
|
|
.d-icon {
|
|
|
|
color: var(--primary);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|