Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 677
Remove Box usage and sx prop from PageHeader#6873
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
Closed
Uh oh!
There was an error while loading. Please reload this page.
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b36e7f3
pulls PageHeader changes from mp/rm-box-and-sx-from-pageheader
mperrotti d48ec5d
pulls in modern-polymorphic
mperrotti 483f23a
adds changeset
mperrotti 3db1f4a
exports PageHeader types
mperrotti 1828a41
updates snapshots
mperrotti 229570e
updates snapshots
mperrotti e0b38ac
fixes Vite crash, updates snapshots for some reason?
mperrotti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@primer/react': major | ||
| --- | ||
| Removes sx prop from PageHeader and subcomponents |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2 packages/react/src/__tests__/__snapshots__/exports.test.ts.snap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| // Mostly taken from https://github.com/total-typescript/react-typescript-tutorial/blob/main/src/08-advanced-patterns/72-as-prop-with-forward-ref.solution.tsx | ||
| import {forwardRef} from 'react' | ||
| import type {ComponentPropsWithRef, ElementType} from 'react' | ||
| /** | ||
| * Distributive Omit utility type that works correctly with union types | ||
| */ | ||
| type DistributiveOmit<T, TOmitted extends PropertyKey> = T extends unknown ? Omit<T, TOmitted> : never | ||
| /** | ||
| * Fixed version of forwardRef that provides better type inference for polymorphic components | ||
| */ | ||
| // TODO: figure out how to change this type so we can set displayName | ||
| // like this: `ComponentName.displayName = 'DisplayName' instead of using workarounds | ||
| type FixedForwardRef = <T, P extends Record<string, unknown> = Record<string, unknown>>( | ||
| render: (props: P, ref: React.Ref<T>) => React.ReactNode, | ||
| ) => (props: P & React.RefAttributes<T>) => React.ReactNode | ||
| /** | ||
| * Cast forwardRef to the fixed version with better type inference | ||
| */ | ||
| export const fixedForwardRef = forwardRef as FixedForwardRef | ||
| /** | ||
| * Simplified polymorphic props type that handles the common pattern of | ||
| * `DistributiveOmit<ComponentPropsWithRef<ElementType extends As ? DefaultElement : As>, 'as'>` | ||
| */ | ||
| export type PolymorphicProps< | ||
| TAs extends ElementType, | ||
| TDefaultElement extends ElementType = 'div', | ||
| Props extends Record<string, unknown> = Record<string, unknown>, | ||
| > = DistributiveOmit<ComponentPropsWithRef<ElementType extends TAs ? TDefaultElement : TAs> & Props, 'as'> & { | ||
| as?: TAs | ||
| } |
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CopilotAISep 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
LinkPropstype parameter is now generic but the function signature still uses the non-generic version. This should beLinkProps<TAs>to maintain type consistency with the generic parameter.