Skip to content

Commit 160fea1

Browse files
author
Cody
committed
Added multiple arguments feature
1 parent 8645905 commit 160fea1

1 file changed

Lines changed: 19 additions & 17 deletions

File tree

_poly-fluid-sizing.scss

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
/// @example
1414
/// @include poly-fluid-sizing('font-size', (576px: 22px, 768px: 24px, 992px: 34px));
1515
/// @author Jake Wilson <jake.e.wilson@gmail.com>
16-
@mixin poly-fluid-sizing($property, $map) {
16+
@mixin poly-fluid-sizing($properties, $map) {
1717
// Get the number of provided breakpoints
1818
$length: length(map-keys($map));
1919

@@ -26,25 +26,27 @@
2626
$map: map-sort($map);
2727
$keys: map-keys($map);
2828

29-
// Minimum size
30-
#{$property}: map-get($map, nth($keys,1));
29+
@each $property in $properties {
30+
// Minimum size
31+
#{$property}: map-get($map, nth($keys,1));
3132

32-
// Interpolated size through breakpoints
33-
@for $i from 1 through ($length - 1) {
34-
@media (min-width:nth($keys,$i)) {
35-
$value1: map-get($map, nth($keys,$i));
36-
$value2: map-get($map, nth($keys,($i + 1)));
37-
// If values are not equal, perform linear interpolation
38-
@if ($value1 != $value2) {
39-
#{$property}: linear-interpolation((nth($keys,$i): $value1, nth($keys,($i+1)): $value2));
40-
} @else {
41-
#{$property}: $value1;
33+
// Interpolated size through breakpoints
34+
@for $i from 1 through ($length - 1) {
35+
@media (min-width:nth($keys,$i)) {
36+
$value1: map-get($map, nth($keys,$i));
37+
$value2: map-get($map, nth($keys,($i + 1)));
38+
// If values are not equal, perform linear interpolation
39+
@if ($value1 != $value2) {
40+
#{$property}: linear-interpolation((nth($keys,$i): $value1, nth($keys,($i+1)): $value2));
41+
} @else {
42+
#{$property}: $value1;
43+
}
4244
}
4345
}
44-
}
4546

46-
// Maxmimum size
47-
@media (min-width:nth($keys,$length)) {
48-
#{$property}: map-get($map, nth($keys,$length));
47+
// Maxmimum size
48+
@media (min-width:nth($keys,$length)) {
49+
#{$property}: map-get($map, nth($keys,$length));
50+
}
4951
}
5052
}

0 commit comments

Comments
 (0)