Skip to content
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

Merged
merged 10 commits into from
Jul 15, 2024

Conversation

thatblindgeye
Copy link
Contributor

@thatblindgeye thatblindgeye commented Jun 25, 2024

What: Closes #10622

Codemod issue: patternfly/pf-codemods#674

Additional issues:

@patternfly-build
Copy link
Contributor

patternfly-build commented Jun 25, 2024

@thatblindgeye thatblindgeye linked an issue Jun 25, 2024 that may be closed by this pull request
Copy link
Contributor

@wise-king-sullyman wise-king-sullyman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

Copy link
Contributor

@mcoker mcoker left a 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:

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}
Copy link
Contributor

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?

Copy link
Contributor Author

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).

packages/react-core/src/components/Page/PageMainBody.tsx Outdated Show resolved Hide resolved
@@ -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}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

</div>
);

PageMainBody.displayName = 'PageMainBody';
Copy link
Contributor

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>?

@thatblindgeye
Copy link
Contributor Author

@mcoker

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)

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.

@mcoker
Copy link
Contributor

mcoker commented Jul 3, 2024

or PageSection with type breadcrumb, do we still intend for a PageSection component to have the breadcrumb class applied?

@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 - <PageBreadcrumb> or <PageSection type="breadcrumb">. Also don't want to add any overhead to this PR, so if it isn't something we want to tackle now, totally fine, I was mostly just curious why there were 3.

@thatblindgeye
Copy link
Contributor Author

@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.

Copy link
Contributor

@mcoker mcoker left a 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?

Comment on lines 268 to 273
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>;
}
Copy link
Contributor

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.

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍯🐝          🐻

@dlabaj dlabaj merged commit b9181ae into patternfly:v6 Jul 15, 2024
13 checks passed
@patternfly-build
Copy link
Contributor

Your changes have been released in:

  • @patternfly/react-code-editor@6.0.0-alpha.83
  • @patternfly/react-core@6.0.0-alpha.83
  • @patternfly/react-docs@7.0.0-alpha.90
  • @patternfly/react-drag-drop@6.0.0-alpha.65
  • @patternfly/react-integration@6.0.0-alpha.43
  • demo-app-ts@5.1.1-alpha.82
  • @patternfly/react-table@6.0.0-alpha.84
  • @patternfly/react-templates@6.0.0-alpha.33

Thanks for your contribution! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Page - updates to allow for section grouping
5 participants