Skip to content

Commit

Permalink
Export NavList from the main bundle (#2112)
Browse files Browse the repository at this point in the history
* Export ActionListDividerProps

* Export NavList from the main bundle

* Add NavList link to the nav

* Create stale-hounds-notice.md

* Add componentId
  • Loading branch information
colebemis authored Jun 9, 2022
1 parent 68395e7 commit 74e1d13
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 10 deletions.
9 changes: 9 additions & 0 deletions .changeset/stale-hounds-notice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@primer/react": minor
---

[NavList](https://primer.style/NavList) is ready to use. You can now import it from the main bundle:

```js
import {NavList} from '@primer/react'
```
12 changes: 7 additions & 5 deletions docs/content/NavList.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
---
title: NavList
status: Draft
description: Use nav list to render a vertical list of navigation links.
status: Alpha
componentId: nav_list
description: Use a nav list to render a vertical list of navigation links.
source: https://github.com/primer/react/tree/main/src/NavList
storybook: '/react/storybook/?path=/story/composite-components-navlist--simple'
---

```js
import {NavList} from '@primer/react/drafts'
import {NavList} from '@primer/react'
```

## Examples
Expand Down Expand Up @@ -333,9 +335,9 @@ function App() {
adaptsToThemes: true,
adaptsToScreenSizes: true,
fullTestCoverage: true,
usedInProduction: false,
usedInProduction: true,
usageExamplesDocumented: true,
hasStorybookStories: false,
hasStorybookStories: true,
designReviewed: false,
a11yReviewed: false,
stableApi: false,
Expand Down
2 changes: 2 additions & 0 deletions docs/src/@primer/gatsby-theme-doctocat/nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@
url: /LabelGroup
- title: Link
url: /Link
- title: NavList
url: /NavList
- title: Overlay
url: /Overlay
- title: Pagehead
Expand Down
5 changes: 3 additions & 2 deletions src/ActionList/Divider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import {get} from '../constants'
import {Theme} from '../ThemeProvider'
import {SxProp, merge} from '../sx'

export type ActionListDividerProps = SxProp

/**
* Visually separates `Item`s or `Group`s in an `ActionList`.
*/

export const Divider: React.FC<SxProp> = ({sx = {}}) => {
export const Divider: React.FC<ActionListDividerProps> = ({sx = {}}) => {
return (
<Box
as="li"
Expand Down
1 change: 1 addition & 0 deletions src/ActionList/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export type {ActionListProps} from './List'
export type {ActionListGroupProps} from './Group'
export type {ActionListItemProps} from './Item'
export type {ActionListLinkItemProps} from './LinkItem'
export type {ActionListDividerProps} from './Divider'
export type {ActionListDescriptionProps} from './Description'
export type {ActionListLeadingVisualProps, ActionListTrailingVisualProps} from './Visuals'

Expand Down
17 changes: 14 additions & 3 deletions src/NavList/NavList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ import {ForwardRefComponent as PolymorphicForwardRefComponent} from '@radix-ui/r
import {useSSRSafeId} from '@react-aria/ssr'
import React, {isValidElement} from 'react'
import styled from 'styled-components'
import {ActionList} from '../ActionList'
import {
ActionList,
ActionListDividerProps,
ActionListLeadingVisualProps,
ActionListTrailingVisualProps
} from '../ActionList'
import Box from '../Box'
import StyledOcticon from '../StyledOcticon'
import sx, {merge, SxProp} from '../sx'
Expand Down Expand Up @@ -154,7 +159,7 @@ function ItemWithSubNav({children, subNav, sx: sxProp = {}}: ItemWithSubNavProps
// ----------------------------------------------------------------------------
// NavList.SubNav

type NavListSubNavProps = {
export type NavListSubNavProps = {
children: React.ReactNode
} & SxProp

Expand Down Expand Up @@ -203,28 +208,34 @@ SubNav.displayName = 'NavList.SubNav'
// ----------------------------------------------------------------------------
// NavList.LeadingVisual

export type NavListLeadingVisualProps = ActionListLeadingVisualProps

const LeadingVisual = ActionList.LeadingVisual

LeadingVisual.displayName = 'NavList.LeadingVisual'

// ----------------------------------------------------------------------------
// NavList.TrailingVisual

export type NavListTrailingVisualProps = ActionListTrailingVisualProps

const TrailingVisual = ActionList.TrailingVisual

TrailingVisual.displayName = 'NavList.TrailingVisual'

// ----------------------------------------------------------------------------
// NavList.Divider

export type NavListDividerProps = ActionListDividerProps

const Divider = ActionList.Divider

Divider.displayName = 'NavList.Divider'

// ----------------------------------------------------------------------------
// NavList.Group

type NavListGroupProps = {
export type NavListGroupProps = {
children: React.ReactNode
title?: string
} & SxProp
Expand Down
11 changes: 11 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export type {
ActionListGroupProps,
ActionListItemProps,
ActionListLinkItemProps,
ActionListDividerProps,
ActionListDescriptionProps,
ActionListLeadingVisualProps,
ActionListTrailingVisualProps
Expand Down Expand Up @@ -95,6 +96,16 @@ export {default as LabelGroup} from './LabelGroup'
export type {LabelGroupProps} from './LabelGroup'
export {default as Link} from './Link'
export type {LinkProps} from './Link'
export {NavList} from './NavList'
export type {
NavListProps,
NavListItemProps,
NavListSubNavProps,
NavListGroupProps,
NavListLeadingVisualProps,
NavListTrailingVisualProps,
NavListDividerProps
} from './NavList'
export {default as Overlay} from './Overlay'
export type {OverlayProps} from './Overlay'
export {default as Pagehead} from './Pagehead'
Expand Down

0 comments on commit 74e1d13

Please sign in to comment.