Skip to content

feat(PageHeader): remove support for sx - #6871

Merged
francinelucca merged 9 commits into
mainfrom
6770-remove-sx-from-page-header
Sep 22, 2025
Merged

feat(PageHeader): remove support for sx#6871
francinelucca merged 9 commits into
mainfrom
6770-remove-sx-from-page-header

Conversation

@joshblack

Copy link
Copy Markdown
Member

Closes#6770

Changelog

New

Changed

Removed

  • Remove support for sx from PageHeader

Rollout strategy

  • Major release; if selected, include a written rollout or migration plan

This change uses our @primer/styled-react package for migration so that components that still have sx usage have been migrated

@joshblack
joshblack requested a review from a team as a code ownerSeptember 17, 2025 17:50
@changeset-bot

changeset-botBot commented Sep 17, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ee038a3

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 staff Author is a staff member integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Sep 17, 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 support for the sx prop from the PageHeader component as part of a major version release. The change uses the @primer/styled-react package to provide backward compatibility for components that still require sx prop support during the migration period.

  • Remove sx prop from PageHeader component types and implementation
  • Create a wrapper implementation in @primer/styled-react package to maintain sx support for migration
  • Update export patterns to expose the wrapper component from the styled-react package

Reviewed Changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 6 comments.

Show a summary per file
FileDescription
packages/react/src/PageHeader/PageHeader.tsxRemove sx prop support from all PageHeader components and sub-components
packages/react/src/index.tsExport additional PageHeader type definitions for the styled-react wrapper
packages/styled-react/src/components/PageHeader.tsxCreate styled-components wrapper to maintain sx prop support
packages/styled-react/src/index.tsxUpdate exports to use the new PageHeader wrapper
packages/styled-react/src/experimental.tsxUpdate experimental exports for PageHeader
packages/styled-react/src/sx.tsAdd re-export of sx utilities from @primer/react
packages/styled-react/src/components/Box.tsxAdd re-export of Box component
packages/styled-react/rollup.config.jsAdd babel plugin for styled-components
packages/styled-react/package.jsonAdd babel-plugin-styled-components dependency
packages/styled-react/ARCHITECTURE.mdUpdate documentation to show styled-components pattern
packages/react/src/PageHeader/PageHeader.docs.jsonRemove sx prop from documentation
packages/react/src/PageHeader/PageHeader.dev.stories.tsxRemove stories demonstrating sx prop usage
.changeset/wet-mammals-feel.mdDocument breaking change for major release

Comment on lines 229 to 231
// @ts-ignore sx has height attribute
const {height} = sxProp
if (height) style['--custom-height'] = height

CopilotAISep 17, 2025

Copy link

Choose a reason for hiding this comment

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

The variable sxProp is no longer defined after removing the sx prop parameter. This will cause a runtime error.

Suggested change
// @ts-ignore sx has height attribute
const{height}=sxProp
if(height)style['--custom-height']=height

Copilot uses AI. Check for mistakes.
Comment on lines 261 to 262
const {height} = sxProp
if (height) style['--custom-height'] = height

CopilotAISep 17, 2025

Copy link

Choose a reason for hiding this comment

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

The variable sxProp is no longer defined after removing the sx prop parameter. This will cause a runtime error.

Copilot uses AI. Check for mistakes.
const Title: React.FC<React.PropsWithChildren<TitleProps>> = ({children, className, hidden = false, as = 'h2'}) => {
const style: CSSCustomProperties = {}
// @ts-ignore sxProp can have color attribute
const {fontSize, lineHeight, fontWeight} = sxProp

CopilotAISep 17, 2025

Copy link

Choose a reason for hiding this comment

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

The variable sxProp is no longer defined after removing the sx prop parameter. This will cause a runtime error.

Copilot uses AI. Check for mistakes.
Comment on lines 309 to 310
const {height} = sxProp
if (height) style['--custom-height'] = height

CopilotAISep 17, 2025

Copy link

Choose a reason for hiding this comment

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

The variable sxProp is no longer defined after removing the sx prop parameter. This will cause a runtime error.

Copilot uses AI. Check for mistakes.
Comment on lines 330 to 331
const {height} = sxProp
if (height) style['--custom-height'] = height

CopilotAISep 17, 2025

Copy link

Choose a reason for hiding this comment

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

The variable sxProp is no longer defined after removing the sx prop parameter. This will cause a runtime error.

Copilot uses AI. Check for mistakes.
Comment on lines 349 to 350
const {height} = sxProp
if (height) style['--custom-height'] = height

CopilotAISep 17, 2025

Copy link

Choose a reason for hiding this comment

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

The variable sxProp is no longer defined after removing the sx prop parameter. This will cause a runtime error.

Copilot uses AI. Check for mistakes.
@github-actions
github-actionsBot requested a deployment to storybook-preview-6871 September 17, 2025 19:31 Abandoned
@github-actions
github-actionsBottemporarily deployed to storybook-preview-6871 September 17, 2025 19:40 Inactive
@github-actions
github-actionsBottemporarily deployed to storybook-preview-6871 September 17, 2025 20:33 Inactive
@github-actionsgithub-actionsBot added integration-tests: failing Changes in this PR cause breaking changes in gh/gh and removed integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Sep 17, 2025
@primer-integration

Copy link
Copy Markdown

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

@primer-integration

Copy link
Copy Markdown

🟢 ci completed with status success.

@github-actionsgithub-actionsBot removed the integration-tests: failing Changes in this PR cause breaking changes in gh/gh label Sep 18, 2025
@github-actionsgithub-actionsBot added the integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh label Sep 18, 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 added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Sep 22, 2025
@github-actions
github-actionsBottemporarily deployed to storybook-preview-6871 September 22, 2025 20:32 Inactive
@francinelucca
francinelucca added this pull request to the merge queueSep 22, 2025
Merged via the queue into main with commit 44b3d73Sep 22, 2025
42 checks passed
@francinelucca
francinelucca deleted the 6770-remove-sx-from-page-header branch September 22, 2025 20:42
@primerprimerBot mentioned this pull request Sep 22, 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/tdmpakpmstaffAuthor is a staff member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove support for sx from the PageHeader component

4 participants

@joshblack@siddharthkp@francinelucca