feat(page): use subgrid to align masthead to page#6870
feat(page): use subgrid to align masthead to page#6870mcoker merged 14 commits intopatternfly:v6from
Conversation
|
Preview: https://patternfly-pr-6870.surge.sh A11y report: https://patternfly-pr-6870-a11y.surge.sh |
77aa949 to
0360296
Compare
|
Through debugging, I found that |
I think what you are saying is to use this? This will make the sidebar no less than 200px - so we need to know what the min desired width is. @lboehling ? If we use WDYT? @mattnolting @mcoker |
@srambach Yes, also removing
I agree, @lboehling what should the |
|
@srambach I also modified page layout. Gave page Added padding to Removed margins from Added border to Removed width from and added negative margin to sidebar, then applied the same inline padding to Updated Updated |
|
This update does a few things - it's a little confusing because names were reused so I'll try to spell it out:
So -
Also
|
| .#{$masthead}__logo { | ||
| align-items: var(--#{$masthead}__logo--AlignItems, var(--#{$masthead}--AlignItems)); | ||
| max-height: var(--#{$masthead}__logo--MaxHeight); | ||
| margin-inline-end: var(--#{$masthead}__logo--MarginInlineEnd); |
There was a problem hiding this comment.
A style like this will keep any kind of image from growing larger than this container.
> * {
max-width: 100%;
max-height: 100%;
vertical-align: middle;
}
IMO we should not make __logo a flex parent, especially if we're relying on align-items: stretch because it can cause the image to stretch. Here is what happens if you put an image in this box now that's super wide - the height is stretching from the parent's flex align-items
The vertical-align property above will be needed if __logo isn't a flex layout since by default, images have a small gap underneath them to account for characters that have a tail (like j, p, q, y, etc).
| .#{$masthead}__logo { | ||
| align-items: var(--#{$masthead}__logo--AlignItems, var(--#{$masthead}--AlignItems)); | ||
| max-height: var(--#{$masthead}__logo--MaxHeight); | ||
| margin-inline-end: var(--#{$masthead}__logo--MarginInlineEnd); |
There was a problem hiding this comment.
Nice, that's a good place for it 👍
| .#{$masthead}__logo, | ||
| .#{$masthead}__content { | ||
| display: flex; | ||
| align-self: stretch; |
There was a problem hiding this comment.
0972f78 to
16feb4b
Compare
There was a problem hiding this comment.
Looks pretty good to me. Want to review the visual regression screenshots. And not a result of this PR, but looks like we're missing --#{$page}__sidebar--PaddingInlineEnd, can you add it back and set it to "0" like --#{$page}__sidebar--PaddingInlineStart below?
| {{~#ifEquals masthead--ColorVariant "light"}} | ||
| pf-m-light | ||
| {{else ifEquals masthead--ColorVariant "light-200"}} | ||
| pf-m-light-200 | ||
| {{/ifEquals}} |
| --#{$masthead}--m-display-inline__brand--GridColumn: unset; | ||
| --#{$masthead}--m-display-inline__brand--Order: unset; |
There was a problem hiding this comment.
This may work but unset is a special keyword that applies to the property its being used on, and in this case the properties are the vars. You can see here that --d: unset does something different than display: unset https://codepen.io/mcoker/pen/NWZrmWb
I would probably do it this way:
| --#{$masthead}--m-display-inline__brand--GridColumn: unset; | |
| --#{$masthead}--m-display-inline__brand--Order: unset; | |
| --#{$masthead}--m-display-inline__brand--GridColumn: initial; | |
| --#{$masthead}--m-display-inline__brand--Order: initial; |
Then update the vars here to add revert as a fallbacks
| --#{$nav}--PaddingInlineStart: 0; // var(--pf-t--global--spacer--md); | ||
| --#{$nav}--PaddingInlineEnd: 0; // var(--pf-t--global--spacer--md); |
There was a problem hiding this comment.
nit to remove comments
| --#{$nav}--PaddingInlineStart: 0; // var(--pf-t--global--spacer--md); | |
| --#{$nav}--PaddingInlineEnd: 0; // var(--pf-t--global--spacer--md); | |
| --#{$nav}--PaddingInlineStart: 0; | |
| --#{$nav}--PaddingInlineEnd: 0; |
| &.pf-m-inset { | ||
| --#{$nav}--PaddingInlineStart: var(--pf-t--global--spacer--md); | ||
| --#{$nav}--PaddingInlineEnd: var(--pf-t--global--spacer--md); |
There was a problem hiding this comment.
did you mean to leave this in? If so we should document it and make sure it's in react. Though we might chat about the name - I think so far, .pf-m-inset has a size modifier, or it's .pf-m-page-insets, and sometimes we have .pf-m-padding if there is just a single padding value someone would want to apply.
There was a problem hiding this comment.
Nah, I'm fine without it if we don't need it!
| grid-area: sidebar; | ||
| grid-row-start: 2; | ||
| grid-column-start: 1; | ||
| width: var(--#{$page}__sidebar--Width); |
There was a problem hiding this comment.
We'll want to keep this around and used up until the xl breakpoint so that it doesn't consume the viewport width when expanded, then we can just set it to auto or something at the xl breakpoint
There was a problem hiding this comment.
I don't think we even need to change it at xl because the grid column is set to the same value.
| // Sidebar body | ||
| --#{$page}__sidebar-body--PaddingInlineEnd: 0; | ||
| --#{$page}__sidebar-body--PaddingInlineStart: 0; | ||
| --#{$page}__sidebar-body--PaddingInlineEnd: var(--pf-t--global--spacer--gutter--default); |
There was a problem hiding this comment.
curious why we wouldn't use var(--pf-t--global--spacer--inset--page-chrome) here, too, to match --#{$page}__sidebar-body--PaddingInlineStart?
There was a problem hiding this comment.
Good question; I think it's just left over from rearranging things different ways.
2c71b33 to
561d032
Compare
There was a problem hiding this comment.
LPTM! Updated this PR with the visual regression screenshots. Here's the report
BackstopJS Report.pdf
|
🎉 This PR is included in version 6.0.0-alpha.202 🎉 The release is available on: Your semantic-release bot 📦🚀 |






This uses subgrid to align the 3 parts of the masthead to the page sidebar and main container. Fixes #6420
Question: Do we want the space along the sides to be larger on xl breakpoint? That was built in but we don't have a token for that. Should we just use the page inset spacer token for all breakpoints? @lboehling
Question: Is it ok for a divider in the navigation to be the width of the nav items rather than all the way across? @lboehling
Note: If the logo is wide, it will force the sidebar column to be wider
Issue: The grid is still giving too much space to the toggle as a result of
(navigation - logo) > toggle