Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion scss/layout/_grid.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
@use "sass:map";
@use "../settings" as *;

// Mixin for generating column span classes
@mixin generate-cols($prefix) {
@for $i from 1 through 12 {
.#{$prefix}-#{$i} {
grid-column: span #{$i};
}
}
}

@if map.get($modules, "layout/grid") and $enable-classes {
/**
* Grid
* Minimal grid system with auto-layout columns
* Minimal grid system with auto-layout and explicit column spans
*/

.grid {
Expand All @@ -13,6 +22,7 @@
display: grid;
grid-template-columns: 1fr;

// Auto-fit columns on medium+ screens when no explicit spans
@if map.get($breakpoints, "md") {
@media (min-width: map.get(map.get($breakpoints, "md"), "breakpoint")) {
grid-template-columns: repeat(auto-fit, minmax(0%, 1fr));
Expand All @@ -23,4 +33,20 @@
min-width: 0; // HACK for children in overflow
}
}

// 12-column explicit grid mode
// Applied when any col-* class is present
.grid:has(> [class*="col-"]) {
grid-template-columns: repeat(12, 1fr);
}

// Explicit column spans (mobile-first)
@include generate-cols("col");

// Medium breakpoint (tablet and up)
@if map.get($breakpoints, "md") {
@media (min-width: map.get(map.get($breakpoints, "md"), "breakpoint")) {
@include generate-cols("col-md");
}
}
}