mirror of
https://github.com/StarCitizenTools/mediawiki-skins-Citizen.git
synced 2024-11-25 14:57:31 +00:00
516ef3a1cb
Putting the dropdown content in the details elemenet have been inconsistent. Transition are not working correctly and different browsers are not handling it well. Furthermore, the previous implementation does not allow an always visible state of dropdown content. Fixes: #882
226 lines
4.8 KiB
Plaintext
226 lines
4.8 KiB
Plaintext
/*
|
|
* Citizen - Mixins
|
|
* https://starcitizen.tools
|
|
*/
|
|
|
|
@import 'variables.less';
|
|
|
|
.citizen-card(@border-radius: true) {
|
|
background-color: var( --color-surface-1 );
|
|
border: 1px solid var( --border-color-base );
|
|
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) {
|
|
pointer-events: none;
|
|
opacity: 0;
|
|
transform: ~'scale@{axis}( 0 )';
|
|
transform-origin: @position;
|
|
|
|
& 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) {
|
|
z-index: @z-index-overlay;
|
|
pointer-events: auto;
|
|
opacity: 1;
|
|
// HACK: So that visiblity won't wait 250ms to become visible
|
|
transition-delay: 0ms;
|
|
transform: none;
|
|
|
|
& 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: var( --transition-menu );
|
|
transition-property: opacity;
|
|
}
|
|
|
|
// Transition animation
|
|
.citizen-card-transition() {
|
|
transition: var( --transition-menu );
|
|
transition-property: transform, opacity;
|
|
}
|
|
|
|
// Header card popups
|
|
.citizen-header-card(@position ) {
|
|
position: absolute;
|
|
right: 0;
|
|
bottom: 100%;
|
|
left: 0;
|
|
max-height: var( --header-card-maxheight );
|
|
|
|
@media ( min-width: @min-width-breakpoint-tablet ) {
|
|
& when (@position =start) {
|
|
right: unset;
|
|
}
|
|
|
|
& when (@position =end) {
|
|
left: unset;
|
|
}
|
|
}
|
|
|
|
@media ( min-width: @min-width-breakpoint-desktop ) {
|
|
right: unset;
|
|
left: 100%;
|
|
|
|
& when (@position =start) {
|
|
top: 0;
|
|
bottom: unset;
|
|
}
|
|
|
|
& when (@position =end) {
|
|
bottom: 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
.citizen-sticky-header(@topOffset: 0, @bottomBorder: true, @zIndex: true) {
|
|
position: -webkit-sticky;
|
|
position: sticky;
|
|
top: @topOffset;
|
|
|
|
& when (@bottomBorder ) {
|
|
border-bottom: 1px solid var( --border-color-base );
|
|
}
|
|
|
|
& when (@zIndex ) {
|
|
z-index: @z-index-page-header;
|
|
}
|
|
|
|
// HACK: Hide overflow
|
|
// This has an issue if parent has overflow set
|
|
&::before {
|
|
position: absolute;
|
|
top: @topOffset;
|
|
right: ~'calc( var(--padding-page ) * -1 )';
|
|
left: ~'calc( var(--padding-page ) * -1 )';
|
|
z-index: -1;
|
|
height: 100%;
|
|
content: '';
|
|
background-color: var( --color-surface-0 );
|
|
filter: opacity( 0.9 );
|
|
backdrop-filter: saturate( 50% ) blur( 16px );
|
|
}
|
|
}
|
|
|
|
// To hide objects, but keep them accessible for screen-readers
|
|
.sr-only() {
|
|
position: absolute;
|
|
width: 1px;
|
|
height: 1px;
|
|
overflow: hidden;
|
|
clip-path: inset( 50% );
|
|
white-space: nowrap;
|
|
}
|
|
|
|
// Set content to be at the center
|
|
.content-center() {
|
|
max-width: var( --width-layout );
|
|
margin-right: auto;
|
|
margin-left: auto;
|
|
}
|
|
|
|
.resource-loader-icon() {
|
|
position: absolute;
|
|
width: inherit;
|
|
height: inherit;
|
|
content: '';
|
|
background-repeat: no-repeat;
|
|
background-position: center;
|
|
}
|
|
|
|
.resource-loader-menu-icon() {
|
|
position: absolute;
|
|
width: @icon-box-size;
|
|
height: @icon-box-size;
|
|
content: '';
|
|
background-repeat: no-repeat;
|
|
background-position: center;
|
|
}
|
|
|
|
.resource-loader-list-icon() {
|
|
position: relative;
|
|
flex-shrink: 0;
|
|
align-self: center;
|
|
width: @icon-size;
|
|
height: @icon-size;
|
|
content: '';
|
|
background-repeat: no-repeat;
|
|
background-position: center;
|
|
background-size: contain;
|
|
}
|
|
|
|
// Button Styles
|
|
.button-blue() {
|
|
color: var( --color-inverted-primary ) !important;
|
|
background-color: var( --color-progressive );
|
|
|
|
.citizen-ui-icon::before {
|
|
filter: var( --filter-invert-primary );
|
|
opacity: 1;
|
|
}
|
|
}
|
|
|
|
.button-blue-hover() {
|
|
background-color: var( --color-progressive--hover );
|
|
}
|
|
|
|
.button-blue-active() {
|
|
background-color: var( --color-progressive--active );
|
|
}
|
|
|
|
.button-red() {
|
|
color: var( --color-inverted-fixed ) !important;
|
|
background-color: var( --color-destructive );
|
|
|
|
.citizen-ui-icon::before {
|
|
filter: var( --filter-invert-fixed );
|
|
opacity: 1;
|
|
}
|
|
}
|
|
|
|
.button-red-hover() {
|
|
background-color: var( --color-destructive--hover );
|
|
}
|
|
|
|
.button-red-active() {
|
|
background-color: var( --color-destructive--active );
|
|
}
|
|
|
|
// Transform black into given color
|
|
// From https://stackoverflow.com/a/73390109/10624167
|
|
.recolor(@color ) {
|
|
@r: red(@color ) / 255;
|
|
@g: green(@color ) / 255;
|
|
@b: blue(@color ) / 255;
|
|
@a: alpha(@color );
|
|
|
|
// grayscale fallback if SVG from data url is not supported
|
|
@lightness: lightness(@color );
|
|
filter: saturate( 0% ) brightness( 0% ) invert( @lightness ) opacity( @a );
|
|
|
|
// color filter
|
|
@svg-filter-id: "recolor";
|
|
filter: url( ';data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"><filter id="@{svg-filter-id}" color-interpolation-filters="sRGB"><feColorMatrix type="matrix" values="0 0 0 0 @{r} 0 0 0 0 @{g} 0 0 0 0 @{b} 0 0 0 @{a} 0"/></filter></svg> #@{svg-filter-id}' );
|
|
}
|