Edge Case: Neat 2.0 + flexbox + justify-content: center + orphan children #543
Description
Background:
I'm trying to achieve an auto-centering layout. Prior to this, the best way to achieve this was through nth-of-type and class wizardry. Primarily because i'd have to account for how many items exist, how many orphans, etc.
With Neat 2.0 + Flexbox, this is ALMOST solved.
The default neat grid allows for orphans to wrap left, and as I keep adding orphans, they automagically stack very nicely.
Adding Flexbox, this is even better, since it makes it so staggered grid-column items wrap without weird float issues. It's like adding an automagic clearfix every nth-of-type.
What I'm trying to achieve, then, is to extend this behavior further with flexbox, by adding justify-content: center
to the parent container. This should, in theory, give me the result below.
However, because neat calculates it's floated position with margin-left, the actual result is this:
My current workaround involves fetching the current custom grid, and adding margin-left and margin-right (half margins) to the the grid-column object, but obviously this gets extremely repetitive and feels very hacky.
The only solution that comes to mind is adding a direction: center
to the grid-media() custom map, which would somehow trigger margins to change from margin-left: $gutter
; to margin-left: $gutter / 2
and margin-right: $gutter / 2
, but that seems to have a lot of ramifications in terms of adding extra complexity to the grid.
thoughts?