-
Notifications
You must be signed in to change notification settings - Fork 355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(Page): updated logic to allow section grouping #10650
Conversation
Preview: https://patternfly-react-pr-10650.surge.sh A11y report: https://patternfly-react-pr-10650-a11y.surge.sh |
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.
Left a few comments. I'm also curious what the difference is between:
- This hardcoded styles.pageMainBreadcrumb in Page.tsx
<PageBreadcrumb>
<PageSection type="breadcrumb">
Just curious if we need all 3, and if so, if we could just have one that generates the markup/styles and the other two places could use it (so we're only creating that section markup once)
@@ -287,7 +288,7 @@ class Page extends React.Component<PageProps, PageState> { | |||
) | |||
)} | |||
> | |||
{isBreadcrumbWidthLimited ? <div className={css(styles.pageMainBody)}>{breadcrumb}</div> : breadcrumb} | |||
{isBreadcrumbWidthLimited ? <PageMainBody>{breadcrumb}</PageMainBody> : breadcrumb} |
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.
Since <PageMainBody>
should always wrap the children of all page section (__main-group
), was there a reason it's only being added here with isBreadcrumbWidthLimited
?
Though looking at this branch, looks like you're on core alpha.150 but the core changes to handle the changes to allow for multiple bodies are in alpha.162 - can you bump core in this PR?
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.
Bumped to latest Core, this will fail due to other PRs needing to go in first (Switch, JumpLinks, etc).
@@ -127,8 +131,7 @@ export const PageSection: React.FunctionComponent<PageSectionProps> = ({ | |||
{...(hasOverflowScroll && { tabIndex: 0 })} | |||
aria-label={ariaLabel} | |||
> | |||
{isWidthLimited && <div className={css(styles.pageMainBody)}>{children}</div>} | |||
{!isWidthLimited && children} | |||
{hasMainBodyWrapper ? <PageMainBody>{children}</PageMainBody> : children} |
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.
👍
</div> | ||
); | ||
|
||
PageMainBody.displayName = 'PageMainBody'; |
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.
Just a nit but all of the other sections are <PageBreadcrumb>
, <PageGroup>
, <PageSection>
- should we call this <PageBody>
?
980971b
to
bd8ac18
Compare
Updated the first instance. For PageSection with type breadcrumb, do we still intend for a PageSection component to have the breadcrumb class applied? Or should consumers just use the PageBreadcrumb component instead? There are some shared classes being applied to both, PageSection having more that can be applied. Alternatively I suppose we axe PageBreadcrumb and just use PageSection with the type="breadcrumb" passed in. |
@thatblindgeye yep - as far as I can tell those 3 places added the same class for the breadcrumb section, which we will want to keep. From my perspective, I'd say whatever works better from your perspective re: which to keep - |
bd8ac18
to
c29243f
Compare
@mcoker Maybe a post-beta thing to look into regarding the PageBreadcrumb component vs PageSection with breadcrumb variant modifier? Would depend if we want to deprecate PageBreadcrumb/if there'd be any repercussions found when looking into it further. |
c786551
to
5b8efdd
Compare
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.
Just one little thing. Also wanted to note there is a yarn.lock
change committed, but no package.json
changes - want to make sure that's intentional?
nav = ( | ||
<div className={css(styles.pageMainNav, styles.modifiers.limitWidth)}> | ||
<div className={css(styles.pageMainBody)}>{horizontalSubnav}</div> | ||
<div className={css(styles.pageMainSubnav, styles.modifiers.limitWidth)}> | ||
<PageBody>{horizontalSubnav}</PageBody> | ||
</div> | ||
); | ||
} else if (horizontalSubnav) { | ||
nav = <div className={css(styles.pageMainNav)}>{horizontalSubnav}</div>; | ||
nav = <div className={css(styles.pageMainSubnav)}>{horizontalSubnav}</div>; | ||
} |
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.
Since <PageBody>
should wrap the children of all sections except for page__main-group
, I think you could update this so <PageBody>
is there with and without isHorizontalSubnavWidthLimited
, and we just dynamically render styles.modifiers.limitWidth
based on whether that prop is true or false.
81f2410
to
12d2327
Compare
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.
🍯🐝 🐻
Your changes have been released in:
Thanks for your contribution! 🎉 |
What: Closes #10622
Codemod issue: patternfly/pf-codemods#674
Additional issues: