Skip to content

Remove sx from UnderlinePanels - #6874

Merged
francinelucca merged 18 commits into
mainfrom
pk/remove-sx-underline-panels
Sep 30, 2025
Merged

Remove sx from UnderlinePanels#6874
francinelucca merged 18 commits into
mainfrom
pk/remove-sx-underline-panels

Conversation

@pksjce

@pksjcepksjce commented Sep 18, 2025

Copy link
Copy Markdown
Contributor

Closes#6804

Changelog

New

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

Co-authored-by: Marie Lucca <francinelucca@users.noreply.github.com>
@pksjce
pksjce requested a review from a team as a code ownerSeptember 18, 2025 01:10
@changeset-bot

changeset-botBot commented Sep 18, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: eb95b53

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

This PR includes changesets to release 2 packages
NameType
@primer/reactMajor
@primer/styled-reactMajor

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-actionsgithub-actionsBot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Sep 18, 2025
@github-actions

Copy link
Copy Markdown
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!

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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 and SxProp type dependencies from the UnderlinePanels component, replacing the styled BoxWithFallback components with standard HTML elements (div). This change is part of a larger effort to remove the sx prop system from Primer React components.

Key changes:

  • Replaces BoxWithFallback usage with native HTML elements
  • Updates type definitions to remove SxProp dependencies
  • Improves type safety with better generic constraints for polymorphic components

Reviewed Changes

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

FileDescription
packages/react/src/internal/components/UnderlineTabbedInterface.tsxRemoves SxProp imports and BoxWithFallback usage, replaces with standard div elements and improves TypeScript generics
packages/react/src/experimental/UnderlinePanels/UnderlinePanels.tsxUpdates Panel component to use div instead of BoxWithFallback and removes BoxProps dependency

Comment on lines +56 to +57
export const UnderlineItem = React.forwardRef((props, ref) => {
const {as: Component = 'a', children, counter, icon: Icon, iconsVisible, loadingCounters, className, ...rest} = props

CopilotAISep 18, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] The forwardRef should include proper TypeScript generics and parameter names for better type inference and debugging. Consider using the same pattern as UnderlineWrapper with explicit generic parameters.

See below for a potential fix:

export const UnderlineItem = React.forwardRef<
HTMLElement,
UnderlineItemProps<ElementType>
>(
(props, ref) => {
const {as: Component = 'a', children, counter, icon: Icon, iconsVisible, loadingCounters, className, ...rest} = props
return (
<Component {...rest} ref={ref} className={clsx(classes.UnderlineItem, className)}>
{iconsVisible && Icon && <span data-component="icon">{isElement(Icon) ? Icon : <Icon />}</span>}
{children && (
<span data-component="text" data-content={children}>
{children}
</span>
)}
{counter !== undefined ? (
loadingCounters ? (
<span data-component="counter">
<LoadingCounter />
</span>
) : (
<span data-component="counter">
<CounterLabel>{counter}</CounterLabel>
</span>
)
) : null}
</Component>
)
}
)

Copilot uses AI. Check for mistakes.
) : null}
</Component>
)
}) as PolymorphicForwardRefComponent<ElementType, UnderlineItemProps<ElementType>>

CopilotAISep 18, 2025

Copy link

Choose a reason for hiding this comment

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

The type assertion uses ElementType as both the constraint and the argument, which may not provide the intended polymorphic behavior. Consider using a more specific constraint like keyof JSX.IntrinsicElements | React.ComponentType<any> to ensure proper component props are inferred.

Suggested change
})asPolymorphicForwardRefComponent<ElementType,UnderlineItemProps<ElementType>>
})asPolymorphicForwardRefComponent<keyofJSX.IntrinsicElements|React.ComponentType<any>,UnderlineItemProps<any>>

Copilot uses AI. Check for mistakes.
@github-actions
github-actionsBot requested a deployment to storybook-preview-6874 September 18, 2025 01:14 Abandoned
@github-actions
github-actionsBottemporarily deployed to storybook-preview-6874 September 18, 2025 01:26 Inactive
@github-actions
github-actionsBottemporarily deployed to storybook-preview-6874 September 18, 2025 12:53 Inactive
@pksjce

pksjce commented Sep 18, 2025

Copy link
Copy Markdown
ContributorAuthor

I understand this PR deals somewhat with UnderlineNav too due to the internal component. The prop sx for UnderlineNav is removed, but styled components usage still exists.

@primer-integration

Copy link
Copy Markdown

👋 Hi from github/github-ui! Your integration PR is ready: https://github.com/github/github-ui/pull/3379

@primer-integration

Copy link
Copy Markdown

🟢 ci completed with status success.

@github-actionsgithub-actionsBot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Sep 29, 2025
@github-actions

Copy link
Copy Markdown
Contributor

👋 Hi, there are new commits since the last successful integration test. We recommend running the integration workflow once more, unless you are sure the new changes do not affect github/github. Thanks!

@liuliu-devliuliu-dev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@github-actionsgithub-actionsBot added integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm and removed integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Sep 30, 2025
@github-actions

Copy link
Copy Markdown
Contributor

👋 Hi, there are new commits since the last successful integration test. We recommend running the integration workflow once more, unless you are sure the new changes do not affect github/github. Thanks!

@github-actionsgithub-actionsBot removed the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Sep 30, 2025
@github-actionsgithub-actionsBot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Sep 30, 2025
@github-actions

Copy link
Copy Markdown
Contributor

👋 Hi, there are new commits since the last successful integration test. We recommend running the integration workflow once more, unless you are sure the new changes do not affect github/github. Thanks!

@github-actions
github-actionsBot requested a deployment to storybook-preview-6874 September 30, 2025 00:44 Abandoned
@francinelucca
francinelucca added this pull request to the merge queueSep 30, 2025
@github-actions
github-actionsBottemporarily deployed to storybook-preview-6874 September 30, 2025 00:52 Inactive
Merged via the queue into main with commit 15824dbSep 30, 2025
42 checks passed
@francinelucca
francinelucca deleted the pk/remove-sx-underline-panels branch September 30, 2025 00:56
@primerprimerBot mentioned this pull request Sep 30, 2025
francinelucca added a commit that referenced this pull request Oct 1, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: passingChanges in this PR do NOT cause breaking changes in gh/ghintegration-tests: recommendedThis 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.

Remove support for sx from the UnderlinePanels component in @primer/react/experimental

5 participants

@pksjce@francinelucca@liuliu-dev@hectahertz