Smarter grid directive for layouts with fixed number of columns (or rows) to achieve cleaner css #1198
Labels
discussion
Further discussion with the team is needed before proceeding
feature
P5
Low-priority issue that needs consideration
Milestone
Feature Request
What is the desired behavior?
A better way to specify a grid layout with a fixed number of rows or columns - and taking advantage of this value to intelligently only add margin where needed - with no negative values.
For example it could look something like this:
Given that we know we have 3 columns - when adding margin we can intelligently do this:
This is similar to the
fxLayoutGutter
directive feature request but specifically for row / column grid layouts where a fixed number of columns or rows is required.A few points:
fxCols
orfxRows
style.flex="0 1 33%"
What is the use-case or motivation for the desired behavior?
Existing directives such as
fxLayoutGap="1em grid"
create fragile css where usage of negative margins and padding is applied. Child components extend beyond the bounds of their parents and when child items are components the grid layout padding conflicts with existing @HostBinding padding from the component itself. This means you have to add another div to wrap the component.Sample code
This is very non-production code I wrote a while ago to test the concept - based upon flexLayoutGap.
Only including the triggerUpdate function - this is for a mythical
fxColumns
directive. Please escuse the hardcoded dimensions.Is there anything else we should know?
The text was updated successfully, but these errors were encountered: