Skip to content

Conversation

mperrotti
Copy link
Contributor

Relates to https://github.com/github/primer/issues/5424 and https://github.com/github/primer/issues/5425

Changelog

New

Changed

sx prop was removed from UnderlineNav and its subcomponents

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 September 17, 2025 15:53
Copy link

changeset-bot bot commented Sep 17, 2025

🦋 Changeset detected

Latest commit: d41cab6

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

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 removes the sx prop from UnderlineNav and its subcomponents as part of the migration away from styled-components. The changes introduce a CSS Modules-based styling approach while maintaining the component's functionality.

Key Changes:

  • Removes sx prop support from UnderlineNav and UnderlineNavItem components
  • Introduces CSS Modules for styling with UnderlineNav.module.css
  • Adds a modern polymorphic utility for better type inference with the as prop
  • Creates styled-react compatibility layer to maintain backward compatibility

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/react/src/UnderlineNav/UnderlineNav.tsx Removes Box usage and sx prop, replaces with CSS Modules classes
packages/react/src/UnderlineNav/UnderlineNavItem.tsx Migrates from Box/sx to modern polymorphic approach with CSS classes
packages/react/src/UnderlineNav/UnderlineNav.module.css New CSS Modules file defining component styles
packages/react/src/utils/modern-polymorphic.ts New utility for improved polymorphic component types
packages/styled-react/src/components/UnderlineNav.tsx Compatibility wrapper to maintain sx prop support in legacy package
packages/react/src/UnderlineNav/UnderlineNav.test.tsx Updates tests to use new function names and constants
packages/react/src/UnderlineNav/UnderlineNav.docs.json Removes sx prop from documentation

Comment on lines 111 to 113
// typecasting to get around a confusing mismatch between `as` props
// between UnderlineNavItem and UnderlineItem
as={as as React.ElementType}
Copy link
Preview

Copilot AI Sep 17, 2025

Choose a reason for hiding this comment

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

The type casting as={as as React.ElementType} suggests a type system mismatch. Consider aligning the type definitions between UnderlineNavItem and UnderlineItem to eliminate the need for this workaround.

Copilot uses AI. Check for mistakes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tried it, couldn't figure it out

Comment on lines +41 to +45
box-shadow:
/* TODO: replace custom shadow with Primer Primitives variable */
/* stylelint-disable-next-line primer/box-shadow */
rgba(0, 0, 0, 0.12) 0 1px 3px,
rgba(0, 0, 0, 0.24) 0 1px 2px;
Copy link
Preview

Copilot AI Sep 17, 2025

Choose a reason for hiding this comment

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

The TODO comment indicates this custom shadow should be replaced with a Primer Primitives variable. Consider creating a follow-up issue to address this technical debt.

Suggested change
box-shadow:
/* TODO: replace custom shadow with Primer Primitives variable */
/* stylelint-disable-next-line primer/box-shadow */
rgba(0, 0, 0, 0.12) 0 1px 3px,
rgba(0, 0, 0, 0.24) 0 1px 2px;
box-shadow: var(--shadow-overlay);

Copilot uses AI. Check for mistakes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this would be the wrong style

@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 Sep 17, 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-6869 September 17, 2025 15:58 Abandoned
@github-actions github-actions bot temporarily deployed to storybook-preview-6869 September 17, 2025 16:11 Inactive
Copy link
Contributor

@hectahertz hectahertz left a comment

Choose a reason for hiding this comment

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

packages/react/src/utils/modern-polymorphic.ts‎ had me second guessing it, as we're adding yet another abstraction (so more complexity in a way) but it's simple enough that it seems useful.

Nice!

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.

2 participants