-
Notifications
You must be signed in to change notification settings - Fork 3.4k
feat(layouts): add @mixin for responsive support for rows #9220
Conversation
I recreated this from an old PR #9112 Now the resultant CSS is actually smaller than master: 52264 (this PR) vs 52805 (master) The auto horizontal margins can be seen with this code pen: http://codepen.io/shortfuse/pen/VjGOEx |
20ab2f0
to
5efdaff
Compare
Add |
Creates @mixin that only triggers when in row configuration. - Dividers now properly display in dynamic layout directions. - Radio Buttons bottom margins are now properly removed when in row configuration. - Input, Select, Radio Buttons and Checkboxes automatically add 16px horizontal margin when in a row and not last item. Previous implementations could not properly detect row configuration where a layout would change direction based on media breakpoints. Fixes angular#9112
5efdaff
to
8f50a92
Compare
@Splaktar Rebased. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. It just needs to be rebased and re-tested. I'll see if I can handle it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually testing this manually, I ran into some regressions. I'll open a new PR that solves those plus handles the rebase.
// Auto insert object margin | ||
@mixin auto-horizontal-margin($selector) { | ||
@include when-layout-row($selector) { | ||
&:not(last-child) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be :last-child
as you noted, or else it would target against <last-child>
tag name, which would be wrong. I would check against a row with 3 items to ensure the auto margins work. It might look right with :first-child
because they're only 2 items.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rule, in theory, should pad $default-horizontal-margin
at the start (left on LTR). Left padding should appear on every item, except the first one, so :not(:first-child)
makes sense.
Maybe I did a last minute change and had it apply margin at the end originally, and failed to adjust. So yeah, :not(:first-child)
is good.
Creates `@mixin` that only triggers when in row configuration. - Dividers now properly display in dynamic layout directions. - Radio Buttons bottom margins are now properly removed when in row configuration. - Input, Select, Radio Buttons and Checkboxes automatically add 16px horizontal margin in front of the element when in a row and not the first item. Previous implementations could not properly detect row configuration where a layout would change direction based on media breakpoints. Fixes #9112. Closes #9220.
Creates `@mixin` that only triggers when in row configuration. - Dividers now properly display in dynamic layout directions. - Radio Buttons bottom margins are now properly removed when in row configuration. - Input, Select, Radio Buttons and Checkboxes automatically add 16px horizontal margin in front of the element when in a row and not the first item. Previous implementations could not properly detect row configuration where a layout would change direction based on media breakpoints. Fixes #9112. Closes #9220. BREAKING CHANGE: The way that margins are applied to `md-checkbox`, `md-input-container`, `md-radio-group`, and `md-select` has been changed. You can now use the `$default-horizontal-margin` Sass variable to override the default `16px` horizontal margin size. As part of this, `md-radio-button`s inside of `layout="row"` containers are now aligned vertically with other content as they no longer have a `16px` `margin-bottom`. If you have previously added custom styles, to your components inside of a row layout, in order to give them extra `margin-right` in LTR or `margin-left` in RTL, you will need to re-evaluate those styles. In most cases, they can now be removed.
Continued this work in PR #11981. |
Creates `@mixin` that only triggers when in row configuration. - Dividers now properly display in dynamic layout directions. - Radio Buttons bottom margins are now properly removed when in row configuration. - Input, Select, Radio Buttons and Checkboxes automatically add 16px horizontal margin in front of the element when in a row and not the first item. Previous implementations could not properly detect row configuration where a layout would change direction based on media breakpoints. Fixes #9112. Closes #9220. BREAKING CHANGE: The way that margins are applied to `md-checkbox`, `md-input-container`, `md-radio-group`, and `md-select` has been changed. You can now use the `$default-horizontal-margin` Sass variable to override the default `16px` horizontal margin size. As part of this, `md-radio-button`s inside of `layout="row"` containers are now aligned vertically with other content as they no longer have a `16px` `margin-bottom`. If you have previously added custom styles, to your components inside of a row layout, in order to give them extra `margin-right` in LTR or `margin-left` in RTL, you will need to re-evaluate those styles. In most cases, they can now be removed.
Creates @mixin that only triggers when in row configuration.
in row configuration.
add 16px horizontal margin when in a row and not last item.
Previous implementations could not properly detect row configuration
where a layout would change direction based on media breakpoints.
Fixes #9112