Skip to content

Conversation

langermank
Copy link
Contributor

Closes https://github.com/github/primer/issues/5897

This is another approach to this PR, which had some code smells checking for line length. I hammered on this issue for a few hours trying to find a CSS only approach, but it seems we have too many edge cases and complexity to how we want actions to wrap or swap ordering.

I paired with @jonrohan and we landed on adding a new prop to support this. The prop essentially lets consumers opt out of the current responsive behavior, setting the action buttons to either inline or stacked. This is useful for dialogs or select panel where we may render a small banner but still want the "desktop" experience.

langermank and others added 3 commits October 15, 2025 16:47
Co-authored-by: Jon Rohan <yes@jonrohan.codes>
Copy link

changeset-bot bot commented Oct 20, 2025

🦋 Changeset detected

Latest commit: c4dbb5b

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

This PR includes changesets to release 2 packages
Name Type
@primer/react Minor
@primer/styled-react Major

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

@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 Oct 20, 2025
Copy link
Contributor

👋 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 requested a deployment to storybook-preview-7045 October 20, 2025 23:14 Abandoned
@langermank langermank added the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Oct 20, 2025
@github-actions github-actions bot temporarily deployed to storybook-preview-7045 October 20, 2025 23:23 Inactive
@github-actions github-actions bot removed the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Oct 20, 2025
@github-actions github-actions bot temporarily deployed to storybook-preview-7045 October 20, 2025 23:35 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-7045 October 20, 2025 23:44 Inactive
@langermank langermank marked this pull request as ready for review October 20, 2025 23:47
@langermank langermank requested review from a team as code owners October 20, 2025 23:47
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new actionsLayout prop to the Banner component to provide explicit control over action button layout, addressing edge cases where the default responsive behavior is undesirable (e.g., banners inside dialogs or select panels).

Key changes:

  • Added actionsLayout prop with options: 'default', 'inline', and 'stacked'
  • Implemented CSS styling to support the new layout modes
  • Removed the BannerDescription className assignment (replaced with direct className prop pass-through)

Reviewed Changes

Copilot reviewed 7 out of 25 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Banner.tsx Added actionsLayout prop definition, default value, and data attribute
Banner.test.tsx Added unit tests verifying the data-actions-layout attribute for all three layout modes
Banner.module.css Implemented CSS rules for inline/stacked layouts and updated selectors to respect actionsLayout
Banner.features.stories.tsx Added story examples demonstrating the new prop in dialogs and at different viewport sizes
Banner.docs.json Added documentation for the new actionsLayout prop
Banner.test.ts Added VRT test coverage for the new layout modes
grumpy-walls-cry.md Added changeset documenting this minor version change

export function BannerDescription({children, className, ...rest}: BannerDescriptionProps) {
return (
<div {...rest} className={clsx('BannerDescription', className)}>
<div {...rest} className={className}>
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

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

The removal of the 'BannerDescription' class from this component appears unrelated to the stated PR purpose of adding actionsLayout functionality. This change could affect existing styles that depend on the BannerDescription class selector and should either be explained in the PR description or moved to a separate PR.

Suggested change
<div {...rest} className={className}>
<div {...rest} className={clsx(className, classes.BannerDescription)}>

Copilot uses AI. Check for mistakes.

Copy link
Member

Choose a reason for hiding this comment

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

This seems like a valid miss?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed it cause it doesn't have any corresponding CSS but I could make that change separately if it feels risky

Copy link
Member

@jonrohan jonrohan left a comment

Choose a reason for hiding this comment

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

🤘🏻

@github-actions github-actions bot requested a deployment to storybook-preview-7045 October 21, 2025 17:04 Abandoned
@langermank langermank added this pull request to the merge queue Oct 21, 2025
Merged via the queue into main with commit 7595b8d Oct 21, 2025
42 checks passed
@langermank langermank deleted the banner-fix branch October 21, 2025 20:45
@primer primer bot mentioned this pull request Oct 21, 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