-
Notifications
You must be signed in to change notification settings - Fork 631
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
Merged
+53
−14
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
e3b7646
Remove sx support from the TabNav component
jonrohan dd57a1e
Create changeset
jonrohan 1029226
Merge branch 'main' into remove_sx_support_tabnav
jonrohan 6998c9a
Merge branch 'main' into remove_sx_support_tabnav
jonrohan 93c4664
Merge branch 'main' into remove_sx_support_tabnav
jonrohan 8c4431e
Use link ref component
jonrohan 8677994
use styled() wrapper in TabNav
francinelucca 41e067c
Merge branch 'main' into remove_sx_support_tabnav
francinelucca 85f4d71
remove unused imports
francinelucca 8594706
Merge branch 'remove_sx_support_tabnav' of github.com:primer/react in…
francinelucca 1cde2a7
fix ttpes
francinelucca ef7a58d
type fixes
francinelucca 9ff5487
fix?
francinelucca 4afea95
eslint ignore
francinelucca 7ee1524
git commit -m "test"
francinelucca be66cd3
fix as prop
francinelucca 51e1b7b
fix fix fix
francinelucca 6de983d
Merge branch 'main' into remove_sx_support_tabnav
jonrohan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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,6 @@ | ||
--- | ||
"@primer/react": major | ||
"@primer/styled-react": patch | ||
--- | ||
|
||
Remove support for `sx` from the `TabNav` component |
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,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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||
|
||
const TabNav = Object.assign(TabNavImpl, { | ||
Link: TabNavLink, | ||
}) | ||
|
||
export {TabNav, type TabNavProps, type TabNavLinkProps} |
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 |
---|---|---|
@@ -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' |
Oops, something went wrong.
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.
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.
Copilot uses AI. Check for mistakes.