Initial commit
This commit is contained in:
11
styles/mixins/adaptive.scss
Normal file
11
styles/mixins/adaptive.scss
Normal file
@@ -0,0 +1,11 @@
|
||||
@mixin mobile {
|
||||
@media (max-width: 480px) {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
|
||||
@mixin desktop {
|
||||
@media (min-width: 481px) {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
48
styles/mixins/element-variant.scss
Normal file
48
styles/mixins/element-variant.scss
Normal file
@@ -0,0 +1,48 @@
|
||||
@use "sass:meta";
|
||||
@use "sass:list";
|
||||
@use "sass:string";
|
||||
|
||||
@mixin element-variant(
|
||||
$namespace,
|
||||
$variant: '',
|
||||
$map: ()
|
||||
) {
|
||||
@if meta.type-of($map) == 'map' {
|
||||
$withDarkVariant: false;
|
||||
$variantPrefix: if(string.length($variant) > 0, '-' + $variant, '');
|
||||
|
||||
@at-root {
|
||||
:root, .light-theme {
|
||||
@each $property, $value in $map {
|
||||
@if meta.type-of($value) == 'list' {
|
||||
@if $withDarkVariant == false and list.length($value) > 1 {
|
||||
$withDarkVariant: true;
|
||||
}
|
||||
|
||||
$value: list.nth($value, 1);
|
||||
}
|
||||
|
||||
--#{$namespace}#{$variantPrefix}-#{$property}: #{$value};
|
||||
}
|
||||
}
|
||||
|
||||
@if $withDarkVariant {
|
||||
.dark-theme {
|
||||
@each $property, $value in $map {
|
||||
@if meta.type-of($value) == 'list' and list.length($value) > 1 {
|
||||
--#{$namespace}#{$variantPrefix}-#{$property}: #{list.nth($value, 2)};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@if (string.length($variant) > 0) {
|
||||
&-#{$variantPrefix} {
|
||||
@each $property, $value in $map {
|
||||
--#{$namespace}-#{$property}: var(--#{$namespace}#{$variantPrefix}-#{$property});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
3
styles/mixins/index.scss
Normal file
3
styles/mixins/index.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
@forward "element-variant";
|
||||
@forward "typography";
|
||||
@forward "adaptive";
|
||||
17
styles/mixins/typography.scss
Normal file
17
styles/mixins/typography.scss
Normal file
@@ -0,0 +1,17 @@
|
||||
@mixin font($size, $weight, $lineHeight, $namespace: null, $onlyVars: false) {
|
||||
@if ($namespace) {
|
||||
@if ($onlyVars) {
|
||||
--#{$namespace}-font-size: #{$size};
|
||||
--#{$namespace}-font-weight: #{$weight};
|
||||
--#{$namespace}-line-height: #{$lineHeight};
|
||||
} @else {
|
||||
font-size: var(--#{$namespace}-font-size, $size);
|
||||
font-weight: var(--#{$namespace}-font-weight, $weight);
|
||||
line-height: var(--#{$namespace}-line-height, $lineHeight);
|
||||
}
|
||||
} @else {
|
||||
font-size: $size;
|
||||
font-weight: $weight;
|
||||
line-height: $lineHeight;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user