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

Export NavList from the main bundle #2112

Merged
merged 6 commits into from
Jun 9, 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
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
colebemis marked this conversation as resolved.
Show resolved Hide resolved
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