1
- // Y-spacings (vertical top and bottom)
2
- $spacings-list-init : (
3
- 1 : $article-spacing-small , 2 : $article-spacing-medium , 3 : $article-spacing-large
1
+ // Outer paddings
2
+ $outer-paddings-list : (
3
+ 0 : $article-outer-padding ,
4
+ xs : $article-outer-padding-xs ,
5
+ s : $article-outer-padding-s ,
6
+ m : 0px ,
7
+ l : 0px ,
8
+ xl : 0px
4
9
);
5
10
11
+ // Y-spacings (vertical top and bottom)
6
12
$spacings-list-bp : (
13
+ 0 : (1 : $article-spacing-small , 2 : $article-spacing-medium , 3 : $article-spacing-large ),
7
14
xs : (1 : $article-spacing-xs-small , 2 : $article-spacing-xs-medium , 3 : $article-spacing-xs-large ),
8
15
s : (1 : $article-spacing-s-small , 2 : $article-spacing-s-medium , 3 : $article-spacing-s-large ),
9
16
m : (1 : $article-spacing-m-small , 2 : $article-spacing-m-medium , 3 : $article-spacing-m-large ),
@@ -49,43 +56,10 @@ main .article_inside {
49
56
--art-px :#{divide ($grid-gutter-width ,2 )} ;
50
57
}
51
58
52
- :root {
53
- --art-ox :#{$article-outer-padding } ;
54
- --art-py-1 :#{$article-spacing-small } ;
55
- --art-py-2 :#{$article-spacing-medium } ;
56
- --art-py-3 :#{$article-spacing-large } ;
57
- }
58
-
59
- @each $size , $spacing in $spacings-list-init {
60
- .art-py-#{$size } {
61
- & , #container {
62
- > .inside {
63
- padding-top : var (--art-py - #{$size } );
64
- padding-bottom : var (--art-py - #{$size } );
65
- }
66
- }
67
- }
68
- }
69
-
70
- @each $size , $spacing in $spacings-list-init {
71
- .art-pt-#{$size } > .inside { padding-top : var (--art-py - #{$size } ); }
72
- .art-pb-#{$size } > .inside { padding-bottom : var (--art-py - #{$size } ); }
73
- .art-ol-self-#{$size } {
74
- padding-bottom : var (--art-py - #{$size } );
75
- + * { margin-bottom : calc (var (--art-py - #{$size } ) * -1 );
76
- > .inside { top : calc (var (--art-py - #{$size } ) * -1 );}
77
- }
78
- }
79
- .art-ol-next-#{$size } {
80
- margin-top : calc (var (--art-py - #{$size } ) * -1 );
81
- > .inside { top : var (--art-py - #{$size } );}
82
- + * { padding-top : var (--art-py - #{$size } );}
83
- }
84
- }
85
-
86
- @each $bp in map-keys ($breakpoints ) {
59
+ @each $bp in map-keys (map-merge ((0 :0 ),$breakpoints )) {
87
60
$infix : breakpoint-infix ($bp );
88
61
$list : map-get ($spacings-list-bp , $bp );
62
+ $index : index (map-keys (map-merge ((0 :0 ),$breakpoints )),$bp );
89
63
@if ($bp == ' l' ) {
90
64
$bp-l-gtr-none : sub (map-get ($breakpoints ,$bp ),$grid-gutter-width ,' px' );
91
65
@media (min-width :$bp-l-gtr-none ) {
@@ -98,23 +72,60 @@ main .article_inside {
98
72
.mr-art { margin-right :var (--art-mx )!important }
99
73
}
100
74
}
101
- @include media-breakpoint ( $bp ) {
102
- @if map-has-key ( $spacings-list-bp , $bp ) {
75
+ @if map-has-key ( $spacings-list-bp , $bp ) {
76
+ @include media-breakpoint ( $bp ) {
103
77
:root {
104
- @if ($bp == ' xs' ) {--art-ox :#{$article-outer-padding-xs } ;}
105
- @if ($bp == ' s' ) {--art-ox :#{$article-outer-padding-s } ;}
106
- @if ($bp == ' m' ) {--art-ox :0px ;}
107
- @each $size , $spacing in $list {--art-py -#{$size } :#{$spacing } ;}
78
+ $outer-padding : map-get ($outer-paddings-list , $bp );
79
+ // Check whether custom vars have to be set for the next breakpoint
80
+ @if ($bp == 0 ) {
81
+ --art-ox :#{$outer-padding } ;
82
+ } @else if #{nth (nth ($outer-paddings-list ,$index - 1 ),2 )} != #{$outer-padding } {
83
+ --art-ox :#{map-get ($outer-paddings-list , $bp )} ;
84
+ }
85
+ @each $size , $spacing in $list {
86
+ @if ($bp == 0 ) {
87
+ --art-py -#{$size } :#{$spacing } ;
88
+ } @else if (#{nth (nth (nth (nth ($spacings-list-bp ,$index - 1 ), 2 ), $size ),2 )} != #{$spacing } ) {
89
+ --art-py -#{$size } :#{$spacing } ;
90
+ }
91
+ }
108
92
}
109
- }
110
- @if ($bp == ' m' ) {
111
- .art-px-3 {--art-wdth :#{$x-spacing-large-m } ;}
112
- [class *= art-px ] {
113
- & , #container {
114
- > .inside {
115
- max-width : var (--art-wdth , auto );
116
- margin-left : auto !important ;
117
- margin-right : auto !important ;
93
+ @if ($bp == 0 ) {
94
+ @each $size , $spacing in $list {
95
+ .art-py-#{$size } {
96
+ & , #container {
97
+ > .inside {
98
+ padding-top : var (--art-py - #{$size } );
99
+ padding-bottom : var (--art-py - #{$size } );
100
+ }
101
+ }
102
+ }
103
+ }
104
+ @each $size , $spacing in $list {
105
+ .art-pt-#{$size } > .inside { padding-top : var (--art-py - #{$size } ); }
106
+ .art-pb-#{$size } > .inside { padding-bottom : var (--art-py - #{$size } ); }
107
+ .art-ol-self-#{$size } {
108
+ padding-bottom : var (--art-py - #{$size } );
109
+ + * { margin-bottom : calc (var (--art-py - #{$size } ) * -1 );
110
+ > .inside { top : calc (var (--art-py - #{$size } ) * -1 );}
111
+ }
112
+ }
113
+ .art-ol-next-#{$size } {
114
+ margin-top : calc (var (--art-py - #{$size } ) * -1 );
115
+ > .inside { top : var (--art-py - #{$size } );}
116
+ + * { padding-top : var (--art-py - #{$size } );}
117
+ }
118
+ }
119
+ }
120
+ @if ($bp == ' m' ) {
121
+ .art-px-3 {--art-wdth :#{$x-spacing-large-m } ;}
122
+ [class *= art-px ] {
123
+ & , #container {
124
+ > .inside {
125
+ max-width : var (--art-wdth , auto );
126
+ margin-left : auto !important ;
127
+ margin-right : auto !important ;
128
+ }
118
129
}
119
130
}
120
131
}
0 commit comments