Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 677
feat(TabNav): remove support for sx prop#6864
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
e3b7646dd57a1e10292266998c9a93c46648c4431e867799441e067c85f4d7185947061cde2a7ef7a58d9ff54874afea957ee1524be66cd351e1b7b6de983dFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| "@primer/react": major | ||
| "@primer/styled-react": patch | ||
| --- | ||
| Remove support for `sx` from the `TabNav` component |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import {TabNav as PrimerTabNav} from '@primer/react/deprecated' | ||
| import type {TabNavProps as PrimerTabNavProps, TabNavLinkProps as PrimerTabNavLinkProps} from '@primer/react/deprecated' | ||
| import {sx, type SxProp} from '../sx' | ||
| import styled from 'styled-components' | ||
| import {type ForwardRefComponent} from '../polymorphic' | ||
| type TabNavProps = PrimerTabNavProps & SxProp | ||
| type TabNavLinkProps = PrimerTabNavLinkProps & SxProp | ||
| const StyledTabNav = styled(PrimerTabNav).withConfig({ | ||
| shouldForwardProp: prop => (prop as keyof TabNavProps) !== 'sx', | ||
| })<TabNavProps>` | ||
| ${sx} | ||
| ` | ||
| // @ts-ignore forwardedAs is valid here but I don't know how to fix the typescript error | ||
| const TabNavImpl = ({as, ...props}: TabNavProps) => <StyledTabNav forwardedAs={as} {...props} /> | ||
| const StyledTabNavLink: ForwardRefComponent<'a', TabNavLinkProps> = styled(PrimerTabNav.Link).withConfig({ | ||
| shouldForwardProp: prop => (prop as keyof TabNavLinkProps) !== 'sx', | ||
| })<TabNavLinkProps>` | ||
| ${sx} | ||
| ` | ||
| // @ts-ignore forwardedAs is valid here but I don't know how to fix the typescript error | ||
| const TabNavLink = ({as, ...props}: TabNavLinkProps) => <StyledTabNavLink forwardedAs={as} {...props} /> | ||
Comment on lines
+25
to
+26
CopilotAI | ||
| const TabNav = Object.assign(TabNavImpl, { | ||
| Link: TabNavLink, | ||
| }) | ||
| export {TabNav, type TabNavProps, type TabNavLinkProps} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| export {Dialog, Octicon, TabNav, Tooltip, type TooltipProps} from '@primer/react/deprecated' | ||
| export {TabNav, type TabNavProps, type TabNavLinkProps} from './components/TabNav' | ||
| export {Dialog, Octicon, Tooltip, type TooltipProps} from '@primer/react/deprecated' |
Uh oh!
There was an error while loading. Please reload this page.
CopilotAISep 25, 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.
Instead of using @ts-ignore, consider using a proper TypeScript assertion or interface extension to handle the forwardedAs prop. This improves type safety and code maintainability.