0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-29 17:36:49 +01:00
wagtail/client/scss/tools/_mixins.general.scss

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

110 lines
2.1 KiB
SCSS
Raw Normal View History

// =============================================================================
// Mixins
// =============================================================================
// Please note that the mixins partial shouldn't include any classes. This is so
// it can be included in any file without accidentally producing output
// Turns on font-smoothing when used. Use sparingly.
@mixin font-smoothing {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
@mixin clearfix() {
&:before,
&:after {
content: ' ';
display: table;
}
&:after {
clear: both;
}
}
@mixin unlist() {
margin-top: 0;
margin-bottom: 0;
padding-inline-start: 0;
list-style-type: none;
font-style: normal;
li {
list-style-type: none;
font-style: normal;
}
}
// remove list styles, but only for the immediate element -
// allow nested lists inside it to keep the default style
@mixin unlistimmediate() {
margin-top: 0;
margin-bottom: 0;
padding-inline-start: 0;
list-style-type: none;
font-style: normal;
> li {
list-style-type: none;
font-style: normal;
}
}
@mixin transition($transition...) {
body.ready & {
transition: $transition;
}
}
2023-03-31 05:46:34 +02:00
@mixin svg-icon($size: 1em, $position: text-top) {
width: $size;
height: $size;
vertical-align: $position;
}
2022-02-01 02:49:55 +01:00
// Applies given rules on hover, for devices that support hover.
@mixin hover {
2022-02-01 02:49:55 +01:00
@media (hover: hover) {
a:hover {
@content;
}
}
}
// Where included, show the focus outline within focusable items instead of around them.
// This is useful when focusable items are tightly packed and there is no space in-between.
@mixin show-focus-outline-inside {
outline-offset: -1 * $focus-outline-width;
}
/**
* Apply styles for the dark theme only.
*/
@mixin dark-theme() {
.w-theme-dark & {
@content;
}
@media (prefers-color-scheme: dark) {
.w-theme-system & {
@content;
}
}
}
/**
* Apply styles for the light theme only.
*/
@mixin light-theme() {
.w-theme-light & {
@content;
}
@media (prefers-color-scheme: light) {
.w-theme-system & {
@content;
}
}
}