2019-08-15 17:40:13 +00:00
|
|
|
/*
|
|
|
|
* Citizen - Mixins
|
|
|
|
* https://starcitizen.tools
|
2023-06-08 19:44:22 +00:00
|
|
|
*/
|
2019-08-15 17:40:13 +00:00
|
|
|
|
2022-12-01 21:13:25 +00:00
|
|
|
@import 'variables.less';
|
|
|
|
|
2021-07-25 23:16:05 +00:00
|
|
|
.citizen-card( @border-radius: true ) {
|
2023-03-01 20:02:34 +00:00
|
|
|
border: 1px solid var( --border-color-base );
|
2021-07-25 23:16:05 +00:00
|
|
|
background-color: var( --color-surface-1 );
|
2022-04-24 19:24:09 +00:00
|
|
|
box-shadow: var( --box-shadow-dialog );
|
2021-07-25 23:16:05 +00:00
|
|
|
|
|
|
|
& when ( @border-radius ) {
|
|
|
|
border-radius: var( --border-radius--medium );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-02 01:23:37 +00:00
|
|
|
// Collaspe animation setup
|
2022-05-12 02:06:33 +00:00
|
|
|
.citizen-card-hide( @position, @axis: '', @fadeChildren: true ) {
|
2022-05-02 01:23:37 +00:00
|
|
|
opacity: 0;
|
|
|
|
pointer-events: none;
|
|
|
|
transform: ~'scale@{axis}( 0 )';
|
|
|
|
transform-origin: @position;
|
2022-05-02 02:40:27 +00:00
|
|
|
visibility: hidden;
|
2022-05-12 02:06:33 +00:00
|
|
|
|
|
|
|
& when ( @fadeChildren ) {
|
|
|
|
> * {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
}
|
2022-05-02 01:23:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Expand animiation setup
|
2022-05-02 02:53:41 +00:00
|
|
|
// When using fadeChildren, the child elements need to have
|
|
|
|
// opacity: 0 set manually
|
|
|
|
.citizen-card-show( @fadeChildren: true ) {
|
2022-05-02 01:23:37 +00:00
|
|
|
opacity: 1;
|
|
|
|
pointer-events: auto;
|
|
|
|
transform: none;
|
2022-05-02 01:46:30 +00:00
|
|
|
// HACK: So that visiblity won't wait 250ms to become visible
|
|
|
|
transition-delay: 0ms;
|
2022-05-02 02:40:27 +00:00
|
|
|
visibility: visible;
|
2022-05-02 02:53:41 +00:00
|
|
|
|
|
|
|
& when ( @fadeChildren ) {
|
|
|
|
> * {
|
|
|
|
.citizen-card-content-show;
|
|
|
|
}
|
|
|
|
}
|
2022-05-02 01:23:37 +00:00
|
|
|
}
|
|
|
|
|
2022-05-02 02:11:31 +00:00
|
|
|
// 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;
|
2022-12-06 20:46:14 +00:00
|
|
|
will-change: opacity;
|
2022-05-02 02:11:31 +00:00
|
|
|
}
|
|
|
|
|
2022-05-02 01:23:37 +00:00
|
|
|
// Transition animation
|
|
|
|
.citizen-card-transition() {
|
2022-05-02 01:46:30 +00:00
|
|
|
transition: @transition-transform, @transition-opacity--transform, @transition-visibility--transform;
|
2022-12-06 20:46:14 +00:00
|
|
|
will-change: transform, opacity, opacity;
|
2022-05-02 01:23:37 +00:00
|
|
|
}
|
|
|
|
|
2022-09-29 23:12:56 +00:00
|
|
|
// Header card popups
|
|
|
|
.citizen-header-card( @position ) {
|
|
|
|
position: absolute;
|
|
|
|
right: 0;
|
|
|
|
bottom: 100%;
|
|
|
|
left: 0;
|
|
|
|
overflow: auto;
|
|
|
|
min-width: 16rem;
|
2022-09-30 20:52:13 +00:00
|
|
|
max-height: var( --header-card-maxheight );
|
2022-11-01 00:34:00 +00:00
|
|
|
margin: var( --space-xs );
|
2022-12-06 20:29:49 +00:00
|
|
|
contain: content;
|
2022-09-29 23:12:56 +00:00
|
|
|
overscroll-behavior: contain;
|
2023-05-23 16:47:26 +00:00
|
|
|
-webkit-user-select: none;
|
2022-09-29 23:12:56 +00:00
|
|
|
user-select: none;
|
|
|
|
.citizen-card();
|
|
|
|
.citizen-card-hide( bottom @position );
|
|
|
|
|
2022-09-30 20:52:13 +00:00
|
|
|
@media ( min-width: @width-breakpoint-tablet ) {
|
|
|
|
& when ( @position = left ) {
|
|
|
|
right: unset;
|
|
|
|
}
|
2022-09-29 23:12:56 +00:00
|
|
|
|
2022-09-30 20:52:13 +00:00
|
|
|
& when ( @position = right ) {
|
|
|
|
left: unset;
|
|
|
|
}
|
2022-09-29 23:12:56 +00:00
|
|
|
}
|
|
|
|
|
2022-09-30 20:52:13 +00:00
|
|
|
@media ( min-width: @width-breakpoint-desktop ) {
|
|
|
|
right: unset;
|
|
|
|
left: 100%;
|
|
|
|
& when ( @position = left ) {
|
|
|
|
top: 0;
|
|
|
|
bottom: unset;
|
|
|
|
.citizen-card-hide( top left );
|
|
|
|
}
|
2022-09-29 23:12:56 +00:00
|
|
|
|
2022-09-30 20:52:13 +00:00
|
|
|
& when ( @position = right ) {
|
|
|
|
bottom: 0;
|
|
|
|
.citizen-card-hide( bottom left );
|
|
|
|
}
|
2022-09-29 23:12:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-13 02:41:19 +00:00
|
|
|
.citizen-sticky-header( @topOffset: 0, @bottomBorder: true, @zIndex: true ) {
|
2023-06-28 17:58:21 +00:00
|
|
|
position: -webkit-sticky;
|
2022-11-25 01:14:44 +00:00
|
|
|
position: sticky;
|
|
|
|
top: @topOffset;
|
|
|
|
|
|
|
|
& when ( @bottomBorder ) {
|
|
|
|
border-bottom: 1px solid var( --border-color-base );
|
|
|
|
}
|
|
|
|
|
2022-12-13 02:41:19 +00:00
|
|
|
& when ( @zIndex ) {
|
|
|
|
z-index: @z-index-page-header;
|
|
|
|
}
|
|
|
|
|
2022-11-25 01:14:44 +00:00
|
|
|
// HACK: Hide overflow
|
|
|
|
// This has an issue if parent has overflow set
|
2023-02-28 21:59:36 +00:00
|
|
|
&::before {
|
2022-11-25 01:14:44 +00:00
|
|
|
position: absolute;
|
|
|
|
z-index: -1;
|
2022-12-01 21:13:25 +00:00
|
|
|
top: @topOffset;
|
2022-11-25 01:14:44 +00:00
|
|
|
right: ~'calc( var(--padding-page ) * -1 )';
|
|
|
|
left: ~'calc( var(--padding-page ) * -1 )';
|
|
|
|
height: 100%;
|
|
|
|
backdrop-filter: saturate( 50% ) blur( 16px );
|
|
|
|
background-color: var( --background-color-overlay );
|
|
|
|
content: '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-15 17:40:13 +00:00
|
|
|
// To hide objects, but keep them accessible for screen-readers
|
2023-06-04 17:16:36 +00:00
|
|
|
// From https://www.a11yproject.com/posts/how-to-hide-content
|
2019-08-15 17:40:13 +00:00
|
|
|
.hidden() {
|
|
|
|
position: absolute;
|
2023-06-04 17:17:24 +00:00
|
|
|
overflow: hidden;
|
2023-06-04 17:16:36 +00:00
|
|
|
width: 1px;
|
2023-06-04 17:17:24 +00:00
|
|
|
height: 1px;
|
|
|
|
clip: rect( 0 0 0 0 );
|
|
|
|
clip-path: inset( 50% );
|
|
|
|
white-space: nowrap;
|
2019-08-15 17:40:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Set content to be at the center
|
|
|
|
.content-center() {
|
2021-01-16 21:14:04 +00:00
|
|
|
max-width: var( --width-layout );
|
2019-08-15 17:40:13 +00:00
|
|
|
margin-right: auto;
|
2021-01-11 16:45:52 +00:00
|
|
|
margin-left: auto;
|
2019-08-15 17:40:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.resource-loader-icon() {
|
|
|
|
position: absolute;
|
|
|
|
width: inherit;
|
|
|
|
height: inherit;
|
|
|
|
background-position: center;
|
2021-01-11 16:45:52 +00:00
|
|
|
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;
|
2021-01-11 16:45:52 +00:00
|
|
|
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;
|
2021-01-11 16:45:52 +00:00
|
|
|
flex-shrink: 0;
|
|
|
|
align-self: center;
|
2019-08-15 17:40:13 +00:00
|
|
|
background-position: center;
|
2021-01-11 16:45:52 +00:00
|
|
|
background-repeat: no-repeat;
|
2021-01-28 17:59:24 +00:00
|
|
|
background-size: contain;
|
2021-01-11 16:45:52 +00:00
|
|
|
content: '';
|
2019-08-15 17:40:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.menu-item-link() {
|
|
|
|
display: flex;
|
2022-05-16 22:12:37 +00:00
|
|
|
align-items: center;
|
2021-01-12 19:31:35 +00:00
|
|
|
color: var( --color-base ) !important;
|
2022-10-23 23:40:19 +00:00
|
|
|
font-weight: var( --font-weight-medium );
|
2022-11-01 00:40:43 +00:00
|
|
|
gap: var( --space-sm );
|
2019-08-15 17:40:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.menu-item-link-hover() {
|
2021-01-12 22:03:52 +00:00
|
|
|
background-color: var( --background-color-primary--hover );
|
2019-08-15 17:40:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.menu-item-link-active() {
|
2021-01-12 22:03:52 +00:00
|
|
|
background-color: var( --background-color-primary--active );
|
2019-08-15 17:40:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Button Styles
|
|
|
|
.button-blue() {
|
2021-01-19 20:56:42 +00:00
|
|
|
background-color: var( --color-primary );
|
|
|
|
color: #fff !important;
|
2022-05-01 23:14:17 +00:00
|
|
|
transition: @transition-background, @transition-color;
|
2019-08-15 17:40:13 +00:00
|
|
|
}
|
|
|
|
|
2021-01-19 20:56:42 +00:00
|
|
|
.button-blue-hover() {
|
|
|
|
background-color: var( --color-primary--hover );
|
|
|
|
}
|
|
|
|
|
2019-08-15 17:40:13 +00:00
|
|
|
.button-blue-active() {
|
2021-01-19 20:56:42 +00:00
|
|
|
background-color: var( --color-primary--active );
|
2019-08-15 17:40:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.button-red() {
|
2021-01-19 20:56:42 +00:00
|
|
|
background-color: var( --color-destructive );
|
|
|
|
color: #fff !important;
|
2022-05-01 23:14:17 +00:00
|
|
|
transition: @transition-background, @transition-color;
|
2019-08-15 17:40:13 +00:00
|
|
|
}
|
|
|
|
|
2021-01-19 20:56:42 +00:00
|
|
|
.button-red-hover() {
|
|
|
|
background-color: var( --color-destructive--hover );
|
|
|
|
}
|
|
|
|
|
2019-08-15 17:40:13 +00:00
|
|
|
.button-red-active() {
|
2021-01-19 20:56:42 +00:00
|
|
|
background-color: var( --color-destructive--active );
|
2019-08-15 17:40:13 +00:00
|
|
|
}
|
2023-06-08 19:44:22 +00:00
|
|
|
|
|
|
|
// 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}' );
|
|
|
|
}
|