Skip to content

Commit

Permalink
refactor(property.variant()): use values.join() and add $modifier
Browse files Browse the repository at this point in the history
… argument to modify class and property.
  • Loading branch information
sciborrudnicki committed Sep 25, 2023
1 parent 21ef23a commit c8c8f5b
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions property/_property.variant.mixin.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Sass.
@use 'sass:list';
@use 'sass:map';

// Variables.
@use 'property.variables' as variables;
Expand All @@ -10,8 +9,10 @@

// Modules.
@use '../class';
@use '../map';
@use '../meta';
@use '../selector';
@use '../values';

// Status: DONE
// Property `property.variant()` mixin sets property variant.
Expand Down Expand Up @@ -42,14 +43,19 @@
$type-function: null,
$functions:null,
$execute: true,
$modifier: null
) {
@if type-of($variant) == map {
$type-function: if($type-function, $type-function, variables.$type-function);
@include class.variant($variant, $pseudo-class, $dictionary, $class-function, map) using($resolved) {
@include class.variant($variant, $pseudo-class, $dictionary, $class-function, map, $modifier) using($resolved) {
@if type-of(map.get($resolved, value)) == map {
@each $attribute, $value in map.get($resolved, value) {
$name: map.get($resolved, property);
@if not $modifier {
$name: values.join((method: space), map.get($resolved, property), map.get($resolved, attribute), $attribute);
}
@include property.set(
(list.join(map.get($resolved, property), map.get($resolved, attribute) $attribute or ()): $value),
($name: $value),
$important,
$prefix,
$separator,
Expand All @@ -60,8 +66,12 @@
);
}
} @else {
$name: map.get($resolved, property);
@if not $modifier {
$name: values.join(map.get($resolved, property), map.get($resolved, attribute));
}
@include property.set(
(list.join(map.get($resolved, property), map.get($resolved, attribute) or ()): map.get($resolved, value)),
($name: map.get($resolved, value)),
$important,
$prefix,
$separator,
Expand Down

0 comments on commit c8c8f5b

Please sign in to comment.