Skip to content

Commit

Permalink
Merge branch 'main' into correct-semantics-for-tablist
Browse files Browse the repository at this point in the history
  • Loading branch information
owenniblock authored Jun 21, 2022
2 parents eadbb48 + 53713b2 commit 211ab37
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 4 deletions.
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})

0 comments on commit 211ab37

Please sign in to comment.