Skip to content

Commit

Permalink
🐛 use grid instead of flexbox for split. Resolves #78
Browse files Browse the repository at this point in the history
  • Loading branch information
ebullient committed Dec 23, 2024
1 parent 5a2835c commit 5b310cc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 40 deletions.
60 changes: 21 additions & 39 deletions src/scss/layout/_split.scss
Original file line number Diff line number Diff line change
@@ -1,55 +1,37 @@
:root {
--split-div-size: 0;
--split-gap-size: 0;
}

split {
display: flex;
gap: unset;
flex-flow: row wrap;
align-content: center;
}

split[even]>* {
flex: 1
--split-gap-size: unset;
}

split[no-margin]>* {
--r-block-margin: 0;
}

@for $i from 1 through 12 {
split[wrap="#{$i}"]>* {
flex: 1 1 calc((100% - (calc(var(--split-gap-size) * (#{$i} - 1))) - (calc(var(--dbg-size) * #{$i} * 2))) / #{$i});
}
}

split[gap="0"] {
--split-gap-size: 0;
gap: unset;
}

@for $i from 1 through 5 {
@for $i from 0 through 5 {
split[gap="#{$i}"] {
--split-gap-size: #{$i}em;
gap: #{$i}em;
}
}

@for $i from 1 through 11 {
split[left="#{$i}"]>*:first-child {
flex: #{$i};
}

split[middle="#{$i}"]>*:nth-child(2) {
flex: #{$i}!important;
}
split[even]:not([wrap])>* {
display: flex;
flex-flow: row wrap;
align-content: center;
gap: var(--split-gap-size);
grid-gap: unset;
}
split[wrap]:not([even]) {
display: grid;
gap: unset;
grid-gap: var(--split-gap-size);

split[right="#{$i}"]>*:nth-child(2) {
flex: #{$i};
}
>* {
margin: auto;
}
}

split[right="#{$i}"]>*:nth-child(3) {
flex: #{$i};
}
@for $i from 1 through 12 {
split[wrap="#{$i}"] {
grid-template-columns: repeat(#{$i}, 1fr);
}
}
2 changes: 1 addition & 1 deletion src/scss/layout/slides-extended.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@import '_tables.scss';

:root {
--dbg-size: 0;
--dbg-size: 1;
}

.dbg,
Expand Down

0 comments on commit 5b310cc

Please sign in to comment.