Skip to content

Commit 62d90af

Browse files
authored
Implement NavList.SubNav (#2064)
* wip subnav * Add active prop to ActionList.Item * Handle nested current item * Add simple storybook story * Update snapshot * Stub tests * Use NavList in PageLayout story * Add test case todo * Fix sx typescript error * Add NavList.Item test * Add subnav tests * Add support for as="button" to ActionList.Item * Add nested subnav test * Update docs * Use spacing primitive * Reset marginY for safari * Document active prop * Create strong-nails-sip.md * Update snapshots
1 parent 87b213d commit 62d90af

File tree

13 files changed

+1778
-1590
lines changed

13 files changed

+1778
-1590
lines changed

.changeset/strong-nails-sip.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/react": patch
3+
---
4+
5+
Add support for sub-items in draft implementation of NavList

docs/content/ActionList.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,12 @@ render(<SelectFields />)
297297
defaultValue="false"
298298
description="Indicate whether the item is selected. Only applies to items that can be selected."
299299
/>
300+
<PropsTableRow
301+
name="active"
302+
type="boolean"
303+
defaultValue="false"
304+
description="Indicate whether the item is active. There should never be more than one active item."
305+
/>
300306
<PropsTableRow
301307
name="disabled"
302308
type="boolean"
@@ -325,6 +331,12 @@ render(<SelectFields />)
325331
required
326332
type="React.ReactNode | ActionList.LeadingVisual | ActionList.Description | ActionList.TrailingVisual"
327333
/>
334+
<PropsTableRow
335+
name="active"
336+
type="boolean"
337+
defaultValue="false"
338+
description="Indicate whether the item is active. There should never be more than one active item."
339+
/>
328340
<PropsTableBasePropRows
329341
elementType="a"
330342
isPolymorphic

docs/content/NavList.mdx

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,16 @@ import {NavList} from '@primer/react/drafts'
135135

136136
### With sub-items
137137

138-
<Note variant="danger">Not implemented yet</Note>
139-
140-
```jsx
138+
```jsx live drafts
141139
<NavList>
142140
<NavList.Item href="/branches">Branches</NavList.Item>
143141
<NavList.Item href="/tags">Tags</NavList.Item>
144142
<NavList.Item>
145143
Actions
146144
<NavList.SubNav>
147-
<NavList.Item href="/actions">General</NavList.Item>
145+
<NavList.Item href="/actions" aria-current="page">
146+
General
147+
</NavList.Item>
148148
<NavList.Item href="/actions/runners">Runners</NavList.Item>
149149
</NavList.SubNav>
150150
</NavList.Item>
@@ -157,30 +157,6 @@ If a `NavList.Item` contains a `NavList.SubNav`, the `NavList.Item` will render
157157

158158
</Note>
159159

160-
<details>
161-
<summary>Rendered HTML</summary>
162-
163-
```html
164-
<nav>
165-
<ul role="list">
166-
<li><a href="/branches">Branches</a></li>
167-
<li><a href="/tags">Tags</a></li>
168-
<li>
169-
<button id="generated-id-1" aria-expanded="false" aria-controls="generated-id-2">
170-
<span>Actions</span>
171-
<span><svg aria-hidden="true">...</svg></span>
172-
</button>
173-
<ul role="list" id="generated-id-2" aria-labelledby="generated-id-1">
174-
<li><a href="/actions">General</a></li>
175-
<li><a href="/actions/runners">Runners</a></li>
176-
</ul>
177-
</li>
178-
</ul>
179-
</nav>
180-
```
181-
182-
</details>
183-
184160
### With a divider
185161

186162
```jsx live drafts

0 commit comments

Comments
 (0)