Commit 41fcd13d authored by Ashfahan Khan's avatar Ashfahan Khan Committed by Martijn Cuppens
Browse files

Utility API improvement: use $key/$value instead of nth (#28828)


Co-Authored-By: default avatarMartijn Cuppens <martijn.cuppens@gmail.com>
parent fd21354d
3 merge requests!31948Examples/Floating-labels: fix bad behavior with autofill,!30064test,!28882fix custom-select-indicator in IE10
Showing with 3 additions and 4 deletions
+3 -4
...@@ -53,7 +53,6 @@ ...@@ -53,7 +53,6 @@
@return $map; @return $map;
} }
// Replace `$search` with `$replace` in `$string` // Replace `$search` with `$replace` in `$string`
// Used on our SVG icon backgrounds for custom forms. // Used on our SVG icon backgrounds for custom forms.
// //
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
$values: zip($values, $values); $values: zip($values, $values);
} }
@each $value in $values { @each $key, $value in $values {
$properties: map-get($utility, property); $properties: map-get($utility, property);
// Multiple properties are possible, for example with vertical or horizontal margins or paddings // Multiple properties are possible, for example with vertical or horizontal margins or paddings
...@@ -21,12 +21,12 @@ ...@@ -21,12 +21,12 @@
$property-class: if($property-class, $property-class, nth($properties, 1)); $property-class: if($property-class, $property-class, nth($properties, 1));
// Don't prefix if value key is null (eg. with shadow class) // Don't prefix if value key is null (eg. with shadow class)
$property-class-modifier: if(nth($value, 1), "-" + nth($value, 1), ""); $property-class-modifier: if($key, "-" + $key, "");
.#{$property-class + $infix + $property-class-modifier} { .#{$property-class + $infix + $property-class-modifier} {
@each $property in $properties { @each $property in $properties {
// stylelint-disable-next-line declaration-no-important // stylelint-disable-next-line declaration-no-important
#{$property}: #{nth($value, 2)} !important; #{$property}: $value !important;
} }
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment