Skip to content

Commit 74e1d13

Browse files
authored
Export NavList from the main bundle (#2112)
* Export ActionListDividerProps * Export NavList from the main bundle * Add NavList link to the nav * Create stale-hounds-notice.md * Add componentId
1 parent 68395e7 commit 74e1d13

File tree

7 files changed

+47
-10
lines changed

7 files changed

+47
-10
lines changed

.changeset/stale-hounds-notice.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@primer/react": minor
3+
---
4+
5+
[NavList](https://primer.style/NavList) is ready to use. You can now import it from the main bundle:
6+
7+
```js
8+
import {NavList} from '@primer/react'
9+
```

docs/content/NavList.mdx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
---
22
title: NavList
3-
status: Draft
4-
description: Use nav list to render a vertical list of navigation links.
3+
status: Alpha
4+
componentId: nav_list
5+
description: Use a nav list to render a vertical list of navigation links.
56
source: https://github.com/primer/react/tree/main/src/NavList
7+
storybook: '/react/storybook/?path=/story/composite-components-navlist--simple'
68
---
79

810
```js
9-
import {NavList} from '@primer/react/drafts'
11+
import {NavList} from '@primer/react'
1012
```
1113

1214
## Examples
@@ -333,9 +335,9 @@ function App() {
333335
adaptsToThemes: true,
334336
adaptsToScreenSizes: true,
335337
fullTestCoverage: true,
336-
usedInProduction: false,
338+
usedInProduction: true,
337339
usageExamplesDocumented: true,
338-
hasStorybookStories: false,
340+
hasStorybookStories: true,
339341
designReviewed: false,
340342
a11yReviewed: false,
341343
stableApi: false,

docs/src/@primer/gatsby-theme-doctocat/nav.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@
9090
url: /LabelGroup
9191
- title: Link
9292
url: /Link
93+
- title: NavList
94+
url: /NavList
9395
- title: Overlay
9496
url: /Overlay
9597
- title: Pagehead

src/ActionList/Divider.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ import {get} from '../constants'
44
import {Theme} from '../ThemeProvider'
55
import {SxProp, merge} from '../sx'
66

7+
export type ActionListDividerProps = SxProp
8+
79
/**
810
* Visually separates `Item`s or `Group`s in an `ActionList`.
911
*/
10-
11-
export const Divider: React.FC<SxProp> = ({sx = {}}) => {
12+
export const Divider: React.FC<ActionListDividerProps> = ({sx = {}}) => {
1213
return (
1314
<Box
1415
as="li"

src/ActionList/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export type {ActionListProps} from './List'
1010
export type {ActionListGroupProps} from './Group'
1111
export type {ActionListItemProps} from './Item'
1212
export type {ActionListLinkItemProps} from './LinkItem'
13+
export type {ActionListDividerProps} from './Divider'
1314
export type {ActionListDescriptionProps} from './Description'
1415
export type {ActionListLeadingVisualProps, ActionListTrailingVisualProps} from './Visuals'
1516

src/NavList/NavList.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ import {ForwardRefComponent as PolymorphicForwardRefComponent} from '@radix-ui/r
33
import {useSSRSafeId} from '@react-aria/ssr'
44
import React, {isValidElement} from 'react'
55
import styled from 'styled-components'
6-
import {ActionList} from '../ActionList'
6+
import {
7+
ActionList,
8+
ActionListDividerProps,
9+
ActionListLeadingVisualProps,
10+
ActionListTrailingVisualProps
11+
} from '../ActionList'
712
import Box from '../Box'
813
import StyledOcticon from '../StyledOcticon'
914
import sx, {merge, SxProp} from '../sx'
@@ -154,7 +159,7 @@ function ItemWithSubNav({children, subNav, sx: sxProp = {}}: ItemWithSubNavProps
154159
// ----------------------------------------------------------------------------
155160
// NavList.SubNav
156161

157-
type NavListSubNavProps = {
162+
export type NavListSubNavProps = {
158163
children: React.ReactNode
159164
} & SxProp
160165

@@ -203,28 +208,34 @@ SubNav.displayName = 'NavList.SubNav'
203208
// ----------------------------------------------------------------------------
204209
// NavList.LeadingVisual
205210

211+
export type NavListLeadingVisualProps = ActionListLeadingVisualProps
212+
206213
const LeadingVisual = ActionList.LeadingVisual
207214

208215
LeadingVisual.displayName = 'NavList.LeadingVisual'
209216

210217
// ----------------------------------------------------------------------------
211218
// NavList.TrailingVisual
212219

220+
export type NavListTrailingVisualProps = ActionListTrailingVisualProps
221+
213222
const TrailingVisual = ActionList.TrailingVisual
214223

215224
TrailingVisual.displayName = 'NavList.TrailingVisual'
216225

217226
// ----------------------------------------------------------------------------
218227
// NavList.Divider
219228

229+
export type NavListDividerProps = ActionListDividerProps
230+
220231
const Divider = ActionList.Divider
221232

222233
Divider.displayName = 'NavList.Divider'
223234

224235
// ----------------------------------------------------------------------------
225236
// NavList.Group
226237

227-
type NavListGroupProps = {
238+
export type NavListGroupProps = {
228239
children: React.ReactNode
229240
title?: string
230241
} & SxProp

src/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export type {
4141
ActionListGroupProps,
4242
ActionListItemProps,
4343
ActionListLinkItemProps,
44+
ActionListDividerProps,
4445
ActionListDescriptionProps,
4546
ActionListLeadingVisualProps,
4647
ActionListTrailingVisualProps
@@ -95,6 +96,16 @@ export {default as LabelGroup} from './LabelGroup'
9596
export type {LabelGroupProps} from './LabelGroup'
9697
export {default as Link} from './Link'
9798
export type {LinkProps} from './Link'
99+
export {NavList} from './NavList'
100+
export type {
101+
NavListProps,
102+
NavListItemProps,
103+
NavListSubNavProps,
104+
NavListGroupProps,
105+
NavListLeadingVisualProps,
106+
NavListTrailingVisualProps,
107+
NavListDividerProps
108+
} from './NavList'
98109
export {default as Overlay} from './Overlay'
99110
export type {OverlayProps} from './Overlay'
100111
export {default as Pagehead} from './Pagehead'

0 commit comments

Comments
 (0)