Skip to content

Commit 6dd0def

Browse files
Move layout-grid classes to utility layer (#1535)
Relocate layout-grid classes to the utility layer to enhance IntelliSense support and ensure better compatibility with other utility classes, particularly for the `display` CSS property.
1 parent 27bd60e commit 6dd0def

File tree

2 files changed

+60
-58
lines changed

2 files changed

+60
-58
lines changed

.changeset/flat-pears-spend.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@obosbbl/grunnmuren-tailwind": patch
3+
---
4+
5+
The layout-grid classes are moved to the @utility layer, this way the classes work with IntelliSense and has better compatability with other utility classes (especially important for controlling the `display` CSS property)

packages/tailwind/tailwind-base.css

Lines changed: 55 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,61 @@
113113
@apply sm:gap-x-4 md:gap-x-9 lg:gap-x-12 xl:gap-x-16;
114114
}
115115

116+
/** Grid base, defines the grid columns and their spacing */
117+
@utility layout-grid {
118+
@apply layout-grid-gap-x sm:grid-cols-14 grid;
119+
}
120+
121+
/** Grid container that applies the grid columns, grid spacing and the container component class */
122+
@utility layout-grid-container {
123+
@apply layout-grid container;
124+
/** Make content of the grid span the mid 12 columns as a default (unless it has another explicit col-span class) */
125+
& > * {
126+
@apply sm:col-start-2 sm:col-span-12;
127+
}
128+
}
129+
130+
@utility layout-subgrid-* {
131+
@apply layout-grid-gap-x grid;
132+
}
133+
134+
@utility layout-subgrid-1 {
135+
@apply grid-cols-1;
136+
}
137+
@utility layout-subgrid-2 {
138+
@apply grid-cols-2;
139+
}
140+
@utility layout-subgrid-3 {
141+
@apply grid-cols-3;
142+
}
143+
@utility layout-subgrid-4 {
144+
@apply grid-cols-4;
145+
}
146+
@utility layout-subgrid-5 {
147+
@apply grid-cols-5;
148+
}
149+
@utility layout-subgrid-6 {
150+
@apply grid-cols-6;
151+
}
152+
@utility layout-subgrid-7 {
153+
@apply grid-cols-7;
154+
}
155+
@utility layout-subgrid-8 {
156+
@apply grid-cols-8;
157+
}
158+
@utility layout-subgrid-9 {
159+
@apply grid-cols-9;
160+
}
161+
@utility layout-subgrid-10 {
162+
@apply grid-cols-10;
163+
}
164+
@utility layout-subgrid-11 {
165+
@apply grid-cols-11;
166+
}
167+
@utility layout-subgrid-12 {
168+
@apply grid-cols-12;
169+
}
170+
116171
@utility layout-gap-x {
117172
@apply gap-x-2;
118173
@apply layout-grid-gap-x;
@@ -202,64 +257,6 @@
202257
}
203258

204259
@layer components {
205-
/*** Grid Layout ***/
206-
207-
.layout-grid,
208-
.layout-grid-container {
209-
/** Grid base: defines the grid columns and their spacing */
210-
@apply layout-grid-gap-x sm:grid-cols-14 grid;
211-
212-
/** Grid container that applies the grid columns, grid spacing and the container component class */
213-
&.layout-grid-container {
214-
@apply container;
215-
/** Make content of the grid span the mid 12 columns as a default (unless it has another explicit col-span class) */
216-
& > * {
217-
@apply sm:col-start-2 sm:col-span-12;
218-
}
219-
}
220-
}
221-
222-
[class*="layout-subgrid-"] {
223-
@apply layout-grid-gap-x grid;
224-
}
225-
226-
[class*="layout-subgrid-1"] {
227-
@apply grid-cols-1;
228-
}
229-
[class*="layout-subgrid-2"] {
230-
@apply grid-cols-2;
231-
}
232-
[class*="layout-subgrid-3"] {
233-
@apply grid-cols-3;
234-
}
235-
[class*="layout-subgrid-4"] {
236-
@apply grid-cols-4;
237-
}
238-
[class*="layout-subgrid-5"] {
239-
@apply grid-cols-5;
240-
}
241-
[class*="layout-subgrid-6"] {
242-
@apply grid-cols-6;
243-
}
244-
[class*="layout-subgrid-7"] {
245-
@apply grid-cols-7;
246-
}
247-
[class*="layout-subgrid-8"] {
248-
@apply grid-cols-8;
249-
}
250-
[class*="layout-subgrid-9"] {
251-
@apply grid-cols-9;
252-
}
253-
[class*="layout-subgrid-10"] {
254-
@apply grid-cols-10;
255-
}
256-
[class*="layout-subgrid-11"] {
257-
@apply grid-cols-11;
258-
}
259-
[class*="layout-subgrid-12"] {
260-
@apply grid-cols-12;
261-
}
262-
263260
/*** Link List component styles ***/
264261
.link-list-container {
265262
@apply @container;

0 commit comments

Comments
 (0)