Skip to content

Commit 2d440c0

Browse files
updated and fixed helpers
1 parent 46a727e commit 2d440c0

5 files changed

Lines changed: 45 additions & 14 deletions

File tree

src/Utilities/_config/_specs.scss

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,22 @@
44
///
55

66
$specs: (
7-
"spaces" : (0,5,10,15,20,30,40,50,75,100,125,150,175,200), // padding and margin (px)
7+
"spaces" : (0,5,10,15,20,30,40,50,75,100,125,150,175,200), // padding and margin (px)
88
"font-weight" : (100,200,300,400,500,600,700,800,900,normal,bold,bolder,lighter),
99
"borders" : (0,1,2,3,4,5), // border width (px)
1010
"border-radius" : (2,4,8,10,12,14,16,500), // (px)
1111
"orders" : (1,2,3,4,5),
1212
"line-height" : (0,1,2,3,4,5),
13-
"z-index" : (-1,0,1,10,20,30,40,50,100,999,9999,99999)
13+
"z-index" : (-1,0,1,10,20,30,40,50,100,999,9999,99999),
14+
"sizes" : (
15+
// used for padding, margin, width and height
16+
("tiny", 1rem), // 16px
17+
("mini", 2rem), // 32px
18+
("small", 4rem), // 64px
19+
("large", 8rem), // 128px
20+
("big", 10rem), // 160px
21+
("huge", 12rem), // 190px
22+
("massive", 18rem), // 288px
23+
("giant", 24rem) // 384px
24+
),
1425
);

src/Utilities/_config/height.scss

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,4 @@ $height-helpers: (
1212
("height-50", 50%),
1313
("height-75", 75%),
1414
("height-100", 100%),
15-
("tiny-height", 1rem), // 16px
16-
("mini-height", 2rem), // 32px
17-
("small-height", 4rem), // 64px
18-
("large-height", 8rem), // 128px
19-
("huge-height", 12rem), // 190px
20-
("giant-height", 24rem) // 384px
2115
);

src/Utilities/_config/width.scss

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,9 @@ $width-helpers: (
99
("width-max-content", max-content),
1010
("width-fit-content", fit-content),
1111
("width-25", 25%),
12+
("width-33", 33%),
1213
("width-50", 50%),
14+
("width-66", 66%),
1315
("width-75", 75%),
1416
("width-100", 100%),
15-
("tiny-width", 1rem), // 16px
16-
("mini-width", 2rem), // 32px
17-
("small-width", 4rem), // 64px
18-
("large-width", 8rem), // 128px
19-
("huge-width", 12rem), // 192px
20-
("giant-width", 24rem) // 384px
2117
);

src/Utilities/helpers.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
@use "variables" as *;
77
@use "mixins" as *;
8+
@use "../_global/_getters" as *;
89

910
@if options('helpers', 'enable') {
1011
/// Align Items
@@ -68,6 +69,7 @@
6869

6970
/// Height
7071
@include setHelperList($height-helpers, "height", "!important");
72+
@include setSizeHelpers(null, specs('sizes'), "height");
7173

7274
/// Inset
7375
@include setNestedHelperList($insets);
@@ -86,6 +88,7 @@
8688

8789
/// Margin
8890
@include setHelperListWithRange($margin-helpers, specs('spaces'), "px", "!important");
91+
@include setSizeHelpers($margin-helpers, specs('sizes'));
8992
@include setHelperListWithRange($margin-helpers, auto, null, "!important"); // margin auto
9093

9194
/// Object-Fit
@@ -100,6 +103,7 @@
100103

101104
/// Padding
102105
@include setHelperListWithRange($padding-helpers, specs('spaces'), "px", "!important");
106+
@include setSizeHelpers($padding-helpers, specs('sizes'));
103107
@include setHelperListWithRange($padding-helpers, auto, null, "!important"); // padding auto
104108

105109
/// Place Content
@@ -135,6 +139,7 @@
135139

136140
/// Width
137141
@include setHelperList($width-helpers, "width", "!important");
142+
@include setSizeHelpers(null, specs('sizes'), "width");
138143

139144
/// Z-Index
140145
@include setHelperListWithRange($z-indexes, specs('z-index'), null, "!important");

src/Utilities/mixins.scss

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,31 @@
103103
}
104104
}
105105

106+
///
107+
/// Set Size Helpers
108+
/// @param {List} $list
109+
/// @param {List} $sizes
110+
/// @param {String} $suffix (must also be a name of css property)
111+
///
112+
@mixin setSizeHelpers($list: null, $sizes: null, $suffix: null) {
113+
114+
@if $suffix {
115+
@each $name, $value in $sizes {
116+
.#{$name}-#{$suffix} {
117+
@include setProperties($suffix, $value, null, "!important");
118+
}
119+
}
120+
} @else {
121+
@each $classname, $prop in $list {
122+
@each $name, $value in $sizes {
123+
.#{$classname}#{$name} {
124+
@include setProperties($prop, $value, null, "!important");
125+
}
126+
}
127+
}
128+
}
129+
}
130+
106131
///
107132
/// Set Properties
108133
/// @param {Property|String} $property

0 commit comments

Comments
 (0)