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

Implement NavList.SubNav #2064

Merged
merged 23 commits into from
May 16, 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
5 changes: 5 additions & 0 deletions .changeset/strong-nails-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": patch
---

Add support for sub-items in draft implementation of NavList
12 changes: 12 additions & 0 deletions docs/content/ActionList.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,12 @@ render(<SelectFields />)
defaultValue="false"
description="Indicate whether the item is selected. Only applies to items that can be selected."
/>
<PropsTableRow
name="active"
type="boolean"
defaultValue="false"
description="Indicate whether the item is active. There should never be more than one active item."
/>
<PropsTableRow
name="disabled"
type="boolean"
Expand Down Expand Up @@ -325,6 +331,12 @@ render(<SelectFields />)
required
type="React.ReactNode | ActionList.LeadingVisual | ActionList.Description | ActionList.TrailingVisual"
/>
<PropsTableRow
name="active"
type="boolean"
defaultValue="false"
description="Indicate whether the item is active. There should never be more than one active item."
/>
<PropsTableBasePropRows
elementType="a"
isPolymorphic
Expand Down
32 changes: 4 additions & 28 deletions docs/content/NavList.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,16 @@ import {NavList} from '@primer/react/drafts'

### With sub-items

<Note variant="danger">Not implemented yet</Note>

```jsx
```jsx live drafts
<NavList>
<NavList.Item href="/branches">Branches</NavList.Item>
<NavList.Item href="/tags">Tags</NavList.Item>
<NavList.Item>
Actions
<NavList.SubNav>
<NavList.Item href="/actions">General</NavList.Item>
<NavList.Item href="/actions" aria-current="page">
General
</NavList.Item>
<NavList.Item href="/actions/runners">Runners</NavList.Item>
</NavList.SubNav>
</NavList.Item>
Expand All @@ -157,30 +157,6 @@ If a `NavList.Item` contains a `NavList.SubNav`, the `NavList.Item` will render

</Note>

<details>
<summary>Rendered HTML</summary>

```html
<nav>
<ul role="list">
<li><a href="/branches">Branches</a></li>
<li><a href="/tags">Tags</a></li>
<li>
<button id="generated-id-1" aria-expanded="false" aria-controls="generated-id-2">
<span>Actions</span>
<span><svg aria-hidden="true">...</svg></span>
</button>
<ul role="list" id="generated-id-2" aria-labelledby="generated-id-1">
<li><a href="/actions">General</a></li>
<li><a href="/actions/runners">Runners</a></li>
</ul>
</li>
</ul>
</nav>
```

</details>

### With a divider

```jsx live drafts
Expand Down
Loading