anki/sass/_button-mixins.scss
Matthias Metelka 23e6b2123e
Redesign deck options inputs (#2082)
* Create _input-mixins.scss

* Use button-mixins on more elements

* Replace <select> tag with custom Select component

* Fix RevertButton causing cursor: pointer when hidden

* Increase SaveButton chevron width

* Hide floating component box-shadow when inactive

* Rework SpinBox and move it into components

* Run eslint and prettier

* Remove leftover options prop

* Pass disabled array to EnumSelector again

* Update MapperRow.svelte

* Darken QHeaderView border color

Slipping this in without an extra PR.

* Adjust disabled color, border and cursor

* Remove redundant icon definition from stylesheets

* Fix deck options initial config

* Fix z-index issues in change notetype screen

It might be best to handle z-index locally in each user component instead of hard-coded component values.

* Give web SpinBox a horizontal design

* Give QRadioButton the same treatment as QCheckBox in #2079

* Fix unused CSS selector warning with base button-mixin

* Remove redundant import

* Fix deck options save button

* Delete input-mixins and remove unused down-arrow

* Run eslint on change-notetype

* Run eslint on components
2022-09-27 12:16:45 +10:00

119 lines
2.9 KiB
SCSS

/* Copyright: Ankitects Pty Ltd and contributors
* License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */
@use "vars";
@use "sass:color";
@import "bootstrap/scss/functions";
@import "bootstrap/scss/variables";
@mixin impressed-shadow($intensity) {
box-shadow: inset 0 calc(var(--buttons-size) / 15) calc(var(--buttons-size) / 5)
rgba(black, $intensity);
}
@mixin border-radius {
border-top-left-radius: var(--border-left-radius);
border-bottom-left-radius: var(--border-left-radius);
border-top-right-radius: var(--border-right-radius);
border-bottom-right-radius: var(--border-right-radius);
}
@mixin background($primary: false) {
@if $primary {
background: linear-gradient(
180deg,
var(--button-primary-gradient-start) 0%,
var(--button-primary-gradient-end) 100%
);
&:hover {
background: linear-gradient(
180deg,
var(--button-primary-hover-gradient-start) 0%,
var(--button-primary-hover-gradient-end) 100%
);
border-color: var(--button-hover-border);
}
} @else {
background: linear-gradient(
180deg,
var(--button-gradient-start) 0%,
var(--button-gradient-end) 100%
);
&:hover {
background: linear-gradient(
180deg,
var(--button-hover-gradient-start) 0%,
var(--button-hover-gradient-end) 100%
);
border-color: var(--button-hover-border);
}
}
}
@mixin base(
$primary: false,
$border: true,
$with-hover: true,
$with-active: true,
$active-class: "",
$with-disabled: true
) {
-webkit-appearance: none;
cursor: pointer;
@if $border {
border: 1px solid var(--button-border);
} @else {
border: none;
}
@include background($primary);
@if ($primary) {
color: white;
} @else {
color: var(--fg);
}
@if ($with-active) {
&:active {
@include impressed-shadow(0.35);
border-color: var(--button-border);
}
@if ($active-class != "") {
&.#{$active-class} {
@include impressed-shadow(0.35);
border-color: var(--button-border);
}
}
}
@if ($with-disabled) {
&[disabled],
&[disabled]:hover {
cursor: not-allowed;
color: var(--fg-disabled);
box-shadow: none !important;
background-color: var(--button-gradient-end);
}
}
}
$focus-color: var(--shadow-focus);
@mixin select($with-disabled: true) {
width: 100%;
white-space: nowrap;
text-overflow: ellipsis;
pointer-events: all;
cursor: pointer;
@include base($with-disabled: $with-disabled);
border-radius: var(--border-radius);
&.rtl {
direction: rtl;
}
}