mediawiki-skins-Citizen/resources/mixins.less

196 lines
4.2 KiB
Plaintext
Raw Normal View History

2019-08-15 17:40:13 +00:00
/*
* Citizen - Mixins
* https://starcitizen.tools
*/
.citizen-card( @border-radius: true ) {
background-color: var( --color-surface-1 );
box-shadow: var( --box-shadow-dialog );
& when ( @border-radius ) {
border-radius: var( --border-radius--medium );
}
}
// Collaspe animation setup
.citizen-card-hide( @position, @axis: '', @fadeChildren: true ) {
opacity: 0;
pointer-events: none;
transform: ~'scale@{axis}( 0 )';
transform-origin: @position;
2022-05-02 02:40:27 +00:00
visibility: hidden;
& when ( @fadeChildren ) {
> * {
opacity: 0;
}
}
}
// Expand animiation setup
// When using fadeChildren, the child elements need to have
// opacity: 0 set manually
.citizen-card-show( @fadeChildren: true ) {
opacity: 1;
pointer-events: auto;
transform: none;
// HACK: So that visiblity won't wait 250ms to become visible
transition-delay: 0ms;
2022-05-02 02:40:27 +00:00
visibility: visible;
& when ( @fadeChildren ) {
> * {
.citizen-card-content-show;
}
}
}
// Fade content when users open the menu
// But GTFO instantly when they close the menu
.citizen-card-content-show() {
opacity: 1;
transition: @transition-opacity--transform;
}
// Transition animation
.citizen-card-transition() {
transition: @transition-transform, @transition-opacity--transform, @transition-visibility--transform;
}
2019-08-15 17:40:13 +00:00
// To hide objects, but keep them accessible for screen-readers
.hidden() {
position: absolute;
top: -9999px;
}
// Set content to be at the center
.content-center() {
max-width: var( --width-layout );
2019-08-15 17:40:13 +00:00
margin-right: auto;
margin-left: auto;
2019-08-15 17:40:13 +00:00
}
// Prepare for RL icons
.resource-loader-icon-link() {
display: block;
2019-08-15 17:40:13 +00:00
width: @icon-box-size;
height: @icon-box-size;
}
.resource-loader-icon-link-small() {
display: block;
2019-08-15 17:40:13 +00:00
width: @icon-size;
height: @icon-size;
}
.resource-loader-icon() {
position: absolute;
width: inherit;
height: inherit;
background-position: center;
background-repeat: no-repeat;
content: '';
2019-08-15 17:40:13 +00:00
}
.resource-loader-menu-icon() {
position: absolute;
width: @icon-box-size;
height: @icon-box-size;
background-position: center;
background-repeat: no-repeat;
content: '';
2019-08-15 17:40:13 +00:00
}
.resource-loader-list-icon() {
position: relative;
width: @icon-size;
height: @icon-size;
flex-shrink: 0;
align-self: center;
2019-08-15 17:40:13 +00:00
background-position: center;
background-repeat: no-repeat;
background-size: contain;
content: '';
2019-08-15 17:40:13 +00:00
}
.menu-item-link() {
display: flex;
color: var( --color-base ) !important;
font-weight: 450;
2019-08-15 17:40:13 +00:00
}
.menu-item-link-hover() {
background-color: var( --background-color-primary--hover );
2019-08-15 17:40:13 +00:00
}
.menu-item-link-active() {
background-color: var( --background-color-primary--active );
2019-08-15 17:40:13 +00:00
}
// Button Styles
.button-blue() {
background-color: var( --color-primary );
color: #fff !important;
transition: @transition-background, @transition-color;
2019-08-15 17:40:13 +00:00
}
.button-blue-hover() {
background-color: var( --color-primary--hover );
}
2019-08-15 17:40:13 +00:00
.button-blue-active() {
background-color: var( --color-primary--active );
2019-08-15 17:40:13 +00:00
}
.button-red() {
background-color: var( --color-destructive );
color: #fff !important;
transition: @transition-background, @transition-color;
2019-08-15 17:40:13 +00:00
}
.button-red-hover() {
background-color: var( --color-destructive--hover );
}
2019-08-15 17:40:13 +00:00
.button-red-active() {
background-color: var( --color-destructive--active );
2019-08-15 17:40:13 +00:00
}
// Gradient overflow
.gradient-overflow(@position) {
position: fixed;
z-index: 3;
width: 100%;
height: @margin-side * 2;
background: @position;
content: '';
2019-08-15 17:40:13 +00:00
}
// Borrowed from Mediawiki core 1.35
// “Clearfix Reloaded” Mixin
// The mixin is used on a container with floating children.
// Margin collapsing is a feature, not a bug, hence relying on `display: block` as default.
// With `.mixin-clearfix( @collapse: false; );` you call it to let `margin`s not collapse.
// See https://www.cssmojo.com/the-very-latest-clearfix-reloaded/
// In future we might replace the `&:after` pseudo-element with
// `display: flow-root;` altogether.
// Support: Firefox 3.5+, Safari 4+, Chrome, Opera 15+, IE 8+
.mixin-clearfix( @collapse: true ) {
&:after {
clear: both;
// Margin collapsing as feature. Apply it.
& when ( @collapse ) {
display: block;
content: '';
}
}
// Margin collapsing as bug. Prevent it.
& when not ( @collapse ) {
&:before,
&:after {
display: table;
content: '';
}
}
}