Skip to content

Commit

Permalink
Add .grid helper
Browse files Browse the repository at this point in the history
  • Loading branch information
theacodes committed Feb 27, 2024
1 parent d6240e2 commit 429689e
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 2 deletions.
29 changes: 29 additions & 0 deletions dist/winter.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/winter.css.map

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions src/styles/layout.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,37 @@ body {
margin-left: auto;
}
}

.grid {
display: grid;
--min: 15ch;
--gap: 1rem;

display: grid;
grid-gap: var(--gap);
/* min() with 100% prevents overflow in extra narrow spaces */
grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--min)), 1fr));

&.col-2 {
grid-template-columns: 1fr 1fr;
}
&.col-3 {
grid-template-columns: 1fr 1fr 1fr;
}
&.col-4 {
grid-template-columns: 1fr 1fr 1fr 1fr;
}

&.col-1-2 {
grid-template-columns: 1fr 2fr;
}
&.col-2-1 {
grid-template-columns: 2fr 1fr;
}
&.col-1-3 {
grid-template-columns: 1fr 3fr;
}
&.col-3-1 {
grid-template-columns: 3fr 1fr;
}
}

0 comments on commit 429689e

Please sign in to comment.