visua/src/functions/_mixins.scss

34 lines
1.1 KiB
SCSS

// Mixin to generate css variables
// If the variable has no prefix, don't assign anything to the $prefix attribute, leave its default value: “”
@mixin generate-css-variables($map, $prefix: "") {
@if $prefix == "" {
@each $name, $value in $map {
--#{$name}: #{$value};
}
} @else {
@each $name, $value in $map {
--#{$prefix}-#{$name}: #{$value};
}
}
}
// Mixin to generate typography css classes
@mixin generate-typo-class($map) {
@each $name, $value in $map {
@if $name == "family" {
font-family: $value;
} @else if $name == "size" {
font-size: $value;
} @else if $name == "weight" {
font-weight: $value;
} @else if $name == "line-height" {
line-height: $value;
} @else if $name == "style" {
font-style: $value;
} @else if $name == "text-transform" {
text-transform: $value;
} @else if $name == "text-decoration" {
text-decoration: $value;
}
}
}