Skip to content

Commit 45a52c1

Browse files
authored
Remove sx rom the SideNav component (#6735)
1 parent 2d01fc4 commit 45a52c1

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

.changeset/rich-walls-fold.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/react': major
3+
---
4+
5+
Update SideNav component to no longer support sx.

packages/react/src/SideNav.tsx

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import Link, {type LinkProps} from './Link'
44
import type React from 'react'
55
import {type PropsWithChildren} from 'react'
66
import {clsx} from 'clsx'
7-
import type {SxProp} from './sx'
87
import classes from './SideNav.module.css'
9-
import {BoxWithFallback} from './internal/components/BoxWithFallback'
108

119
type SideNavBaseProps = {
1210
as?: React.ElementType
@@ -15,16 +13,15 @@ type SideNavBaseProps = {
1513
className?: string
1614
children?: React.ReactNode
1715
'aria-label'?: string
18-
} & SxProp
16+
}
1917

2018
function SideNav({
21-
as = 'nav',
19+
as: Component = 'nav',
2220
variant = 'normal',
2321
className,
2422
bordered,
2523
children,
2624
'aria-label': ariaLabel,
27-
sx: sxProp,
2825
}: SideNavBaseProps) {
2926
const variantClassName = variant === 'lightweight' ? 'lightweight' : 'normal'
3027
const newClassName = clsx(
@@ -39,9 +36,9 @@ function SideNav({
3936
)
4037

4138
return (
42-
<BoxWithFallback as={as} className={newClassName} aria-label={ariaLabel} sx={sxProp}>
39+
<Component className={newClassName} aria-label={ariaLabel}>
4340
{children}
44-
</BoxWithFallback>
41+
</Component>
4542
)
4643
}
4744

@@ -58,15 +55,9 @@ const SideNavLink = ({selected, to, variant, className, children, ...rest}: Styl
5855
// according to their docs, NavLink supports aria-current:
5956
// https://reacttraining.com/react-router/web/api/NavLink/aria-current-string
6057
return (
61-
<BoxWithFallback
62-
as={Link}
63-
aria-current={isReactRouter || selected ? 'page' : undefined}
64-
className={newClassName}
65-
variant={variant}
66-
{...rest}
67-
>
58+
<Link aria-current={isReactRouter || selected ? 'page' : undefined} className={newClassName} {...rest}>
6859
{children}
69-
</BoxWithFallback>
60+
</Link>
7061
)
7162
}
7263

0 commit comments

Comments
 (0)