aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/molecules/grid/grid.module.scss
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-10-18 19:25:02 +0200
committerArmand Philippot <git@armandphilippot.com>2023-11-11 18:14:41 +0100
commit94448fa278ab352a741ff13f22d6104869571144 (patch)
tree2185e77f2866d11a0144d4ac5a01c71a76807341 /src/components/molecules/grid/grid.module.scss
parentc153f93dc8691a71dc76aad3dd618298da9d238a (diff)
feat(components): add a generic Grid component
* merge Columns, Gallery and CardsList into Grid component * add more options to control the grid
Diffstat (limited to 'src/components/molecules/grid/grid.module.scss')
-rw-r--r--src/components/molecules/grid/grid.module.scss41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/components/molecules/grid/grid.module.scss b/src/components/molecules/grid/grid.module.scss
new file mode 100644
index 0000000..e253a89
--- /dev/null
+++ b/src/components/molecules/grid/grid.module.scss
@@ -0,0 +1,41 @@
+.wrapper {
+ display: grid;
+ gap: var(--gap);
+
+ &--is-centered {
+ place-content: center;
+ }
+
+ &--has-fixed-size {
+ grid-template-columns: repeat(
+ var(--col, auto-fit),
+ min(100vw - (var(--spacing-md) * 2), var(--size))
+ );
+ }
+
+ &--has-min-size {
+ grid-template-columns: repeat(
+ var(--col, auto-fit),
+ minmax(
+ min(100vw - (var(--spacing-md) * 2), var(--size-min)),
+ var(--size-max, 1fr)
+ )
+ );
+ }
+
+ &:not(#{&}--has-fixed-size):not(#{&}--has-min-size) {
+ grid-template-columns: repeat(
+ var(--col, auto-fit),
+ minmax(0, var(--size-max, 1fr))
+ );
+ }
+}
+
+.item {
+ display: flex;
+ flex-flow: row wrap;
+
+ > * {
+ flex: 1;
+ }
+}