feat(logo-grid): support customizing the grid through variables #30
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I hate this grid! :D Insanely complicated to create an internal border!
I was planning to fix it by using nth-last-child selector together with ~ selector but apparently you cannot use ~ with ::slotted. Only compound selectors and no combinators are allowed.
Before I reached that conclusion I also learned that sass doesnt support & selector within
::slotted()
(makes sense). There's a proposal being worked on for it and meanwhile material design does stuff like this.Next consideration was
grid-gap: 1px
, where we could set a background color on the grid, and then override it on the cells. Doesn't work since empty cells will have the background color of the grid. We could fix it in the Stencil component but not in WP.Next up, I thought about adding an absolute positioned ::after element over the entire grid with
touch-events: none
that would have a border that overlaps the external border of the items. But there's no way of automatically setting the correct border-color of this pseudo element to match the background color. This could still be a valid solution if we cant hide the overflow. In WP it would work since we set--block-background
when a block changes the background color, but it's sort of nasty.Finally I settled with negative margins and
overflow: hidden
. Downside is that future variations eg hover styles cant overflow. Also due to using this approach we cannot use auto-fill columns since the width of the grid container wouldnt be known, and easily become larger than the grid, thus showing the border. This is fine I think and also applies to the previous solution.Oh and I used
minmax
for the grid column sizes so that if it does need to scale down, it will. Previously it was overflowing the viewport on small screens.WP implementation using Gallery block is:
Let's hope we eventually get w3c/csswg-drafts#2748