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

Add prop to PageHeader to allow a bottom border #5741

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mperrotti
Copy link
Contributor

Relates to https://github.com/github/primer/issues/2837

Screenshot 2025-03-06 at 4 11 06 PM

Changelog

New

  • hasBorder prop on PageHeader

Changed

Removed

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

Merge checklist

@mperrotti mperrotti requested a review from a team as a code owner March 6, 2025 21:15
@mperrotti mperrotti requested a review from joshblack March 6, 2025 21:15
Copy link

changeset-bot bot commented Mar 6, 2025

🦋 Changeset detected

Latest commit: 47c50c7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Mar 6, 2025

Uh oh! @mperrotti, at least one image you shared is missing helpful alt text. Check your pull request body to fix the following violations:

  • Images should have meaningful alternative text (alt text) at line 7

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.

🤖 Beep boop! This comment was added automatically by github/accessibility-alt-text-bot.

Copy link
Contributor

github-actions bot commented Mar 6, 2025

👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks!

@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Mar 6, 2025
Copy link
Contributor

github-actions bot commented Mar 6, 2025

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 106.06 KB (+0.12% 🔺)
packages/react/dist/browser.umd.js 106.41 KB (+0.11% 🔺)

@@ -176,6 +183,7 @@ const Root = React.forwardRef<HTMLDivElement, React.PropsWithChildren<PageHeader
ref={rootRef}
as={as}
className={clsx(enabled && classes.PageHeader, className)}
data-has-border={hasBorder}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
data-has-border={hasBorder}
data-has-border={hasBorder ? '' : undefined}

Small suggestion so that in the HTML it shows up as data-has-border when true and then we can target it with just [data-has-border]. When it's not in the DOM it's removed.

I also asked this question in our CSS Modules group to see if there was a style preference here 🤔 Not sure what folks prefer and this is definitely just a style thing

@@ -754,6 +762,7 @@ const Navigation: React.FC<React.PropsWithChildren<NavigationProps>> = ({
aria-label={as === 'nav' ? ariaLabel : undefined}
aria-labelledby={as === 'nav' ? ariaLabelledBy : undefined}
className={clsx(enabled && classes.Navigation, className)}
data-component="PH_Navigation"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
data-component="PH_Navigation"
data-component="PageHeader.Navigation"

One suggestion that could make it more clear what the component is when coming back to this later

@lukasoppermann
Copy link
Contributor

@mperrotti somehow I can't add this comment to the code, but we need this: hasBorder={args.hasBorder} on the Playground story: https://github.com/primer/react/pull/5741/files#diff-38be7109ab257cb99d6f1950aa251d530e55a99c8705aaf94ff68f2d98c82897R195

@lukasoppermann
Copy link
Contributor

Also it is buggy for those two cases:
CleanShot 2025-03-07 at 10 21 54@2x
CleanShot 2025-03-07 at 10 22 25@2x

I wonder if we should disable those cases, so that lines can not be added when a Navigation or description is enabled?

But for a normal text description it could be useful.

@primer primer deleted a comment from github-actions bot Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants