From 5e85447ec418e45de4335a870ba9860e4a277df4 Mon Sep 17 00:00:00 2001 From: Derrick Marcey Date: Fri, 30 Aug 2019 13:50:37 -0400 Subject: [PATCH 1/2] Fixing some Tab/UnderlineNav Link types. --- index.d.ts | 10 ++++++---- pages/components/docs/TabNav.md | 1 + pages/components/docs/UnderlineNav.md | 28 ++++++++++++++------------- src/TabNav.js | 5 +++-- src/UnderlineNav.js | 1 + 5 files changed, 26 insertions(+), 19 deletions(-) diff --git a/index.d.ts b/index.d.ts index e2557e2e8a2..73dd5380775 100644 --- a/index.d.ts +++ b/index.d.ts @@ -241,12 +241,13 @@ declare module '@primer/components' { 'aria-label'?: string } - export interface TabNavItemProps extends CommonProps { + export interface TabNavLinkProps extends CommonProps { + href: string selected?: boolean } export const TabNav: React.FunctionComponent & { - Item: React.FunctionComponent + Link: React.FunctionComponent } export interface TextInputProps extends CommonProps { @@ -284,12 +285,13 @@ declare module '@primer/components' { label?: string } - export interface UnderlineNavItemProps extends CommonProps { + export interface UnderlineNavLinkProps extends CommonProps { + href: string selected?: boolean } export const UnderlineNav: React.FunctionComponent & { - Item: React.FunctionComponent + Link: React.FunctionComponent } export const theme: Object diff --git a/pages/components/docs/TabNav.md b/pages/components/docs/TabNav.md index 87ed900d2ed..6918d61f7f6 100644 --- a/pages/components/docs/TabNav.md +++ b/pages/components/docs/TabNav.md @@ -41,6 +41,7 @@ TabNav and TabNav.Link components get `COMMON` system props. Read our [System Pr | Prop name | Type | Description | | :-------- | :------ | :----------------------------------------------- | | as | String | sets the HTML tag for the component | +| href | String | URL to be used for the Link | | selected | Boolean | Used to style the link as selected or unselected | export const meta = {displayName: 'TabNav'} diff --git a/pages/components/docs/UnderlineNav.md b/pages/components/docs/UnderlineNav.md index b23c61004c3..4d74cb98d99 100644 --- a/pages/components/docs/UnderlineNav.md +++ b/pages/components/docs/UnderlineNav.md @@ -4,8 +4,8 @@ Use the UnderlineNav component to style navigation with a minimal underlined sel To use UnderlineNav with [react-router](https://github.com/ReactTraining/react-router) or [react-router-dom](https://www.npmjs.com/package/react-router-dom), pass -```as={NavLink}``` and omit the ```selected``` prop. -This ensures that the NavLink gets ```activeClassName='selected'``` +`as={NavLink}` and omit the `selected` prop. +This ensures that the NavLink gets `activeClassName='selected'` **Attention:** Make sure to properly label your `UnderlineNav` with an `aria-label` to provide context about the type of navigation contained in `UnderlineNav`. @@ -28,21 +28,23 @@ This ensures that the NavLink gets ```activeClassName='selected'``` UnderlineNav and UnderlineNav.Link components get `COMMON` system props. Read our [System Props](/components/docs/system-props) doc page for a full list of available props. - ## Component props ### UnderlineNav -| Prop name | Type | Description | -| :- | :- | :- | -| actions | Node | Place another element, such as a button, to the opposite side of the navigation items.| -| align | String | Use `right` to have navigation items aligned right. | -| full | Boolean | Used to make navigation fill the width of the container. | -| aria-label | String | Used to set the `aria-label` on the top level `