Skip to content

Commit eeec4d5

Browse files
authored
fix: various fixes to CSS grid
1 parent 89b7f27 commit eeec4d5

File tree

1 file changed

+36
-87
lines changed

1 file changed

+36
-87
lines changed

www/shared/react/grid/grid.module.css

Lines changed: 36 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -27,134 +27,83 @@
2727

2828
/* Row: justify-content */
2929
@each $justify-content-variant in (flex-start, center, flex-end, space-between, space-around, space-evenly) {
30-
.row-justify-content-$(justify-content-variant) {
31-
justify-content: $justify-content-variant;
32-
}
33-
3430
@each $breakpoint in (xxs, xs, sm, md, lg, xl, xxl) {
35-
.row-justify-content-$(breakpoint)-$(justify-content-variant) {
36-
justify-content: $justify-content-variant;
31+
@media (--gte-$breakpoint) {
32+
.row-justify-content-$(breakpoint)-$(justify-content-variant) {
33+
justify-content: $justify-content-variant;
34+
}
3735
}
3836
}
3937
}
4038

4139
/* Row: align-items */
4240
@each $align-items-variant in (flex-start, center, flex-end, baseline, stretch) {
43-
.row-align-items-$(align-items-variant) {
44-
align-items: $align-items-variant;
45-
}
46-
4741
@each $breakpoint in (xxs, xs, sm, md, lg, xl, xxl) {
48-
.row-align-items-$(breakpoint)-$(align-items-variant) {
49-
align-items: $align-items-variant;
42+
@media (--gte-$breakpoint) {
43+
.row-align-items-$(breakpoint)-$(align-items-variant) {
44+
align-items: $align-items-variant;
45+
}
5046
}
5147
}
5248
}
5349

54-
/* Col: auto */
55-
.col-column-auto {
56-
width: auto;
57-
flex: 0 0 auto;
58-
}
59-
50+
/* col: [xxs, xxl] */
6051
@each $breakpoint in (xxs, xs, sm, md, lg, xl, xxl) {
52+
$columns: 12;
53+
$offsets: 11;
54+
6155
@media (--gte-$breakpoint) {
56+
/* columns = auto */
6257
.col-column-$(breakpoint)-auto {
6358
width: auto;
59+
max-width: none;
6460
flex: 0 0 auto;
6561
}
66-
}
67-
}
6862

69-
/* Col: [xxs, xs] */
70-
@each $breakpoint in (xxs, xs) {
71-
$columns: 4;
72-
$offsets: 3;
73-
74-
/* columns = <number> */
75-
@for $x from 1 to $columns by 1 {
76-
@media (--gte-$breakpoint) {
77-
.col-column-$(x) {
78-
max-width: calc($x / $columns * 100%);
79-
flex: 0 0 calc($x / $columns * 100%);
80-
}
63+
/* columns = <number> */
64+
@for $x from 1 to $columns by 1 {
8165
.col-column-$(breakpoint)-$(x) {
66+
width: calc($x / $columns * 100%);
8267
max-width: calc($x / $columns * 100%);
8368
flex: 0 0 calc($x / $columns * 100%);
8469
}
8570
}
86-
}
8771

88-
/* offset = <number> */
89-
@for $x from 0 to $offsets by 1 {
90-
@media (--gte-$breakpoint) {
91-
.col-offset-$(x) {
92-
margin-left: calc($x / $columns * 100%);
93-
}
94-
.col-offset-$(breakpoint)-$(x) {
95-
margin-left: calc($x / $columns * 100%);
72+
/* offset = <number> */
73+
@for $x from 0 to $offsets by 1 {
74+
@media (--gte-$breakpoint) {
75+
.col-offset-$(breakpoint)-$(x) {
76+
margin-left: calc($x / $columns * 100%);
77+
}
9678
}
9779
}
9880
}
9981
}
10082

101-
/* col: [sm, sm] */
102-
@each $breakpoint in (sm) {
83+
/* Col: [xxs, sm] (overrides) */
84+
@each $breakpoint in (xxs, xs, sm) {
10385
$columns: 8;
10486
$offsets: 7;
10587

106-
/* columns = <number> */
107-
@for $x from 1 to $columns by 1 {
108-
@media (--gte-$breakpoint) {
109-
.col-column-$(x) {
110-
max-width: calc($x / $columns * 100%);
111-
flex: 0 0 calc($x / $columns * 100%);
112-
}
113-
.col-column-$(breakpoint)-$(x) {
114-
max-width: calc($x / $columns * 100%);
115-
flex: 0 0 calc($x / $columns * 100%);
116-
}
117-
}
118-
}
119-
120-
/* offset = <number> */
121-
@for $x from 0 to $offsets by 1 {
122-
@media (--gte-$breakpoint) {
123-
.col-offset-$(x) {
124-
margin-left: calc($x / $columns * 100%);
125-
}
126-
.col-offset-$(breakpoint)-$(x) {
127-
margin-left: calc($x / $columns * 100%);
128-
}
88+
@media (--gte-$breakpoint) and (--lt-md) {
89+
/* columns = auto */
90+
.col-column-$(breakpoint)-auto {
91+
width: auto;
92+
max-width: none;
93+
flex: 0 0 auto;
12994
}
130-
}
131-
}
13295

133-
/* col: [md, xxl] */
134-
@each $breakpoint in (md, lg, xl, xxl) {
135-
$columns: 12;
136-
$offsets: 11;
137-
138-
/* columns = <number> */
139-
@for $x from 1 to $columns by 1 {
140-
@media (--gte-$breakpoint) {
141-
.col-column-$(x) {
142-
max-width: calc($x / $columns * 100%);
143-
flex: 0 0 calc($x / $columns * 100%);
144-
}
96+
/* columns = <number> */
97+
@for $x from 1 to $columns by 1 {
14598
.col-column-$(breakpoint)-$(x) {
99+
width: calc($x / $columns * 100%);
146100
max-width: calc($x / $columns * 100%);
147101
flex: 0 0 calc($x / $columns * 100%);
148102
}
149103
}
150-
}
151104

152-
/* offset = <number> */
153-
@for $x from 0 to $offsets by 1 {
154-
@media (--gte-$breakpoint) {
155-
.col-offset-$(x) {
156-
margin-left: calc($x / $columns * 100%);
157-
}
105+
/* offset = <number> */
106+
@for $x from 0 to $offsets by 1 {
158107
.col-offset-$(breakpoint)-$(x) {
159108
margin-left: calc($x / $columns * 100%);
160109
}

0 commit comments

Comments
 (0)