Skip to content

Commit

Permalink
feat(variant/indicator): add submodule to handle + in variants.
Browse files Browse the repository at this point in the history
  • Loading branch information
sciborrudnicki committed Oct 5, 2023
1 parent 251d89d commit 9fb0fca
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions variant/_index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@forward 'indicator' as indicator-*;
@forward 'update' as update-*;
@forward 'variant.create.function';
@forward 'variant.modify.function';
Expand Down
2 changes: 2 additions & 0 deletions variant/indicator/_index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@forward 'indicator.index.function';
@forward 'indicator.remove.function';
17 changes: 17 additions & 0 deletions variant/indicator/_indicator.index.function.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Modules.
@use '../../string';

// Status: DONE
// The `indicator.index()` function.
// @param `$item`
// @param `$indicator`
// @returns
@function index($item, $indicator) {
@each $value in $item {
$index: string.index(#{$value}, $indicator);
@if $index {
@return $index > 0;
}
}
@return false;
}
24 changes: 24 additions & 0 deletions variant/indicator/_indicator.remove.function.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Sass.
@use 'sass:list';

// Modules.
@use '../../list/remove';
@use '../../string';

// Status: TODO:
// The `indicator.remove()` function.
// @param `$item`
// @param `$indicator`
// @returns
@function remove($item, $indicator) {
$i: 1;
$item: remove.value($item, '+');
@each $value in $item {
@if type-of($value) == string {
$item: list.set-nth($item, $i, string.replace(#{$value}, all, $indicator, ''));
}

$i: $i + 1;
}
@return $item;
}

0 comments on commit 9fb0fca

Please sign in to comment.