summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2022-02-14 10:21:54 +0100
committerVolpeon <git@volpeon.ink>2022-02-14 10:21:54 +0100
commit8a2910f6ae20fc1991ed44f2f8c0bddc227f7b9d (patch)
treed85d6c47bdd67f0da4d3f24aae00ef500f632fa7
parentUpdate (diff)
downloadiro-design-8a2910f6ae20fc1991ed44f2f8c0bddc227f7b9d.tar.gz
iro-design-8a2910f6ae20fc1991ed44f2f8c0bddc227f7b9d.tar.bz2
iro-design-8a2910f6ae20fc1991ed44f2f8c0bddc227f7b9d.zip
Auto-gen padding and margin utilities
-rw-r--r--src/_utils.scss42
1 files changed, 34 insertions, 8 deletions
diff --git a/src/_utils.scss b/src/_utils.scss
index 3c8b1c3..99c751c 100644
--- a/src/_utils.scss
+++ b/src/_utils.scss
@@ -1,6 +1,14 @@
1@use 'iro-sass/src/index' as iro; 1@use 'iro-sass/src/index' as iro;
2@use 'functions' as fn; 2@use 'functions' as fn;
3 3
4$dirs: (
5 '': '',
6 't': '-top',
7 'r': '-right',
8 'b': '-bottom',
9 'l': '-left',
10);
11
4@include iro.bem-utility('d-block') { 12@include iro.bem-utility('d-block') {
5 display: block; 13 display: block;
6} 14}
@@ -26,16 +34,34 @@
26 position: relative; 34 position: relative;
27} 35}
28 36
29@include iro.bem-utility('mt-0') { 37@each $dir, $suffix in $dirs {
30 margin-top: 0; 38 @include iro.bem-utility('m#{$dir}-auto') {
31} 39 margin#{$suffix}: auto;
40 }
41
42 @include iro.bem-utility('m#{$dir}-0') {
43 margin#{$suffix}: 0;
44 }
32 45
33@include iro.bem-utility('ml-auto') { 46 @each $size in ('xxs' 'xs' 'sm' 'md' 'lg' 'xl') {
34 margin-left: auto; 47 @include iro.bem-utility('m#{$dir}-#{$size}') {
48 margin#{$suffix}: fn.global-dim(--spacing --#{$size});
49 }
50 }
35} 51}
36 52
37@each $size in ('xxs' 'xs' 'sm' 'md' 'lg' 'xl') { 53@each $dir, $suffix in $dirs {
38 @include iro.bem-utility('p-#{$size}') { 54 @include iro.bem-utility('p#{$dir}-auto') {
39 padding: fn.global-dim(--spacing --#{$size}); 55 padding#{$suffix}: auto;
56 }
57
58 @include iro.bem-utility('p#{$dir}-0') {
59 padding#{$suffix}: 0;
60 }
61
62 @each $size in ('xxs' 'xs' 'sm' 'md' 'lg' 'xl') {
63 @include iro.bem-utility('p#{$dir}-#{$size}') {
64 padding#{$suffix}: fn.global-dim(--spacing --#{$size});
65 }
40 } 66 }
41} 67}