Skip to content
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

Deprecate SideNav in favor of NavList #2120

Merged
merged 4 commits into from
Jun 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .changeset/small-donkeys-provide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
"@primer/react": patch
---

Deprecate SideNav in favor of [NavList](https://primer.style/NavList).

## Before

```jsx
<SideNav aria-label="Main">
<SideNav.Link href="/" selected>
Home
</SideNav.Link>
<SideNav.Link href="/about">About</SideNav.Link>
<SideNav.Link href="/contact">Contact</SideNav.Link>
</SideNav>
```

## After

```jsx
<NavList aria-label="Main">
<NavList.Item href="/" aria-current="page">
Home
</NavList.Item>
<NavList.Item href="/about">About</NavList.Item>
<NavList.Item href="/contact">Contact</NavList.Item>
</NavList>
```
32 changes: 30 additions & 2 deletions docs/content/SideNav.md → docs/content/deprecated/SideNav.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,38 @@
---
componentId: side_nav
title: SideNav
status: Alpha
status: Deprecated
---

The Side Nav is a vertical list of navigational links, typically used on the left side of a page. For maximum flexibility, **SideNav elements have no default width or positioning.**
The Side Nav is a vertical list of navigational links, typically used on the left side of a page. For maximum flexibility, SideNav elements have no default width or positioning.

## Deprecation

Use [NavList](/NavList) instead.

**Before**

```jsx
<SideNav aria-label="Main">
<SideNav.Link href="/" selected>
Home
</SideNav.Link>
<SideNav.Link href="/about">About</SideNav.Link>
<SideNav.Link href="/contact">Contact</SideNav.Link>
</SideNav>
```

**After**

```jsx
<NavList aria-label="Main">
<NavList.Item href="/" aria-current="page">
Home
</NavList.Item>
<NavList.Item href="/about">About</NavList.Item>
<NavList.Item href="/contact">Contact</NavList.Item>
</NavList>
```

## Default example

Expand Down
5 changes: 3 additions & 2 deletions docs/src/@primer/gatsby-theme-doctocat/nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@
url: /Select
- title: SelectPanel
url: /SelectPanel
- title: SideNav
url: /SideNav

- title: Spinner
url: /Spinner
- title: StateLabel
Expand Down Expand Up @@ -184,3 +183,5 @@
url: /deprecated/Position
- title: SelectMenu
url: /deprecated/SelectMenu
- title: SideNav
url: /deprecated/SideNav
1 change: 1 addition & 0 deletions src/SideNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,5 @@ SideNavLink.displayName = 'SideNav.Link'
export type SideNavProps = ComponentProps<typeof SideNav>
export type SideNavLinkProps = ComponentProps<typeof SideNavLink>

/** @deprecated Use [NavList](https://primer.style/react/NavList) instead */
export default Object.assign(SideNav, {Link: SideNavLink})