WordPress/wp-content/themes/twentytwentyone/assets/sass/02-tools/mixins.scss

74 lines
1.7 KiB
SCSS
Raw Normal View History

// Responsive breakpoints mixin
@mixin add_variables( $view: frontend ) {
@if frontend == $view {
:root {
@content;
}
}
@if editor == $view {
:root,
body {
@content;
}
}
}
// Button style
// - Applies button styles to blocks and elements that share them.
@mixin button-style() {
line-height: var(--button--line-height);
color: var(--button--color-text);
cursor: pointer;
font-weight: var(--button--font-weight);
font-family: var(--button--font-family);
font-size: var(--button--font-size);
background-color: var(--button--color-background);
border-radius: var(--button--border-radius);
border: var(--button--border-width) solid var(--button--color-background);
text-decoration: none;
padding: var(--button--padding-vertical) var(--button--padding-horizontal);
&:focus {
background: transparent;
outline-offset: -6px;
outline: 2px dotted currentColor;
.is-dark-theme & {
color: var(--button--color-background);
}
&:not(.has-background) {
color: var(--button--color-text-hover);
}
}
&:disabled {
background-color: var(--global--color-white-50);
border-color: var(--global--color-white-50);
color: var(--button--color-text-active);
}
}
@mixin innerblock-margin-clear($container) {
// Clear the top margin for the first-child.
> #{$container} > *:first-child {
margin-top: 0;
}
// Last child that is not the appender.
> #{$container} > *:last-child:not(.block-list-appender) {
margin-bottom: 0;
}
// When selected, the last item becomes the second last because of the appender.
&.has-child-selected > #{$container} > *:nth-last-child(2),
&.is-selected > #{$container} > *:nth-last-child(2) {
margin-bottom: 0;
}
}