From 583c1f31f6a7a7053033f4fd960a4e5d272ad903 Mon Sep 17 00:00:00 2001 From: Matthew Costabile Date: Mon, 20 Jun 2022 16:55:10 +0000 Subject: [PATCH 1/6] passthrough actionlist group props to navlist.group --- src/NavList/NavList.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/NavList/NavList.tsx b/src/NavList/NavList.tsx index 798e39b82a3..9e7fde58f1b 100644 --- a/src/NavList/NavList.tsx +++ b/src/NavList/NavList.tsx @@ -6,6 +6,7 @@ import styled from 'styled-components' import { ActionList, ActionListDividerProps, + ActionListGroupProps, ActionListLeadingVisualProps, ActionListTrailingVisualProps } from '../ActionList' @@ -235,18 +236,18 @@ Divider.displayName = 'NavList.Divider' // ---------------------------------------------------------------------------- // NavList.Group -export type NavListGroupProps = { +export type NavListGroupProps = Omit & { children: React.ReactNode - title?: string } & SxProp +const defaultSx = {} // TODO: ref prop -const Group = ({title, children, sx: sxProp = {}}: NavListGroupProps) => { +const Group: React.VFC = ({title, children, sx: sxProp = defaultSx, ...props}) => { return ( <> {/* Hide divider if the group is the first item in the list */} - + {children} From 732c93da00efff49e986591dce7dc34b1ad6e7c3 Mon Sep 17 00:00:00 2001 From: Matthew Costabile Date: Mon, 20 Jun 2022 16:56:12 +0000 Subject: [PATCH 2/6] changeset --- .changeset/smooth-balloons-hope.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/smooth-balloons-hope.md diff --git a/.changeset/smooth-balloons-hope.md b/.changeset/smooth-balloons-hope.md new file mode 100644 index 00000000000..e9229a3c876 --- /dev/null +++ b/.changeset/smooth-balloons-hope.md @@ -0,0 +1,5 @@ +--- +'@primer/react': patch +--- + +Passthrough ActionList.Group props from NavList.Group From 5719cc81b2c7dd2cdbe0d0d4b7cca0fe1e882dec Mon Sep 17 00:00:00 2001 From: Matthew Costabile Date: Mon, 20 Jun 2022 18:48:15 +0000 Subject: [PATCH 3/6] pass through props --- docs/content/NavList.mdx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/content/NavList.mdx b/docs/content/NavList.mdx index 61f2cd0bf8f..92a43838e8d 100644 --- a/docs/content/NavList.mdx +++ b/docs/content/NavList.mdx @@ -317,6 +317,16 @@ function App() { {/* Should `title` be required? */} + + the ActionList.Group docs + + } + elementType="a" + isPolymorphic + refType="HTMLAnchorElement" + /> ### NavList.Divider From f64dd58a68a06e30b3d5a07f6d4e1a280bc12484 Mon Sep 17 00:00:00 2001 From: Matthew Costabile Date: Mon, 20 Jun 2022 19:01:22 +0000 Subject: [PATCH 4/6] fix pass through block --- docs/content/NavList.mdx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/content/NavList.mdx b/docs/content/NavList.mdx index 92a43838e8d..f6579654514 100644 --- a/docs/content/NavList.mdx +++ b/docs/content/NavList.mdx @@ -323,9 +323,7 @@ function App() { the ActionList.Group docs } - elementType="a" - isPolymorphic - refType="HTMLAnchorElement" + elementName="ActionList.Group" /> From a952a03cb104989c72519d395f0230ce85f39329 Mon Sep 17 00:00:00 2001 From: Cole Bemis Date: Mon, 20 Jun 2022 14:43:15 -0700 Subject: [PATCH 5/6] Update docs/content/NavList.mdx --- docs/content/NavList.mdx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/content/NavList.mdx b/docs/content/NavList.mdx index f6579654514..7b27948294d 100644 --- a/docs/content/NavList.mdx +++ b/docs/content/NavList.mdx @@ -315,7 +315,6 @@ function App() { {/* Should `title` be required? */} - ActionList.Group docs } - elementName="ActionList.Group" + elementType="ActionList.Group" /> From 9d19daf755f9da12df68221f1109704801fb26fd Mon Sep 17 00:00:00 2001 From: Matthew Costabile Date: Tue, 21 Jun 2022 01:21:48 +0000 Subject: [PATCH 6/6] avoid passing through action list props, but spread additional props to allow aria and data attributes through --- docs/content/NavList.mdx | 9 +-------- src/NavList/NavList.tsx | 4 ++-- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/docs/content/NavList.mdx b/docs/content/NavList.mdx index 7b27948294d..61f2cd0bf8f 100644 --- a/docs/content/NavList.mdx +++ b/docs/content/NavList.mdx @@ -315,15 +315,8 @@ function App() { {/* Should `title` be required? */} + - - the ActionList.Group docs - - } - elementType="ActionList.Group" - /> ### NavList.Divider diff --git a/src/NavList/NavList.tsx b/src/NavList/NavList.tsx index 9e7fde58f1b..40386ad7f2a 100644 --- a/src/NavList/NavList.tsx +++ b/src/NavList/NavList.tsx @@ -6,7 +6,6 @@ import styled from 'styled-components' import { ActionList, ActionListDividerProps, - ActionListGroupProps, ActionListLeadingVisualProps, ActionListTrailingVisualProps } from '../ActionList' @@ -236,8 +235,9 @@ Divider.displayName = 'NavList.Divider' // ---------------------------------------------------------------------------- // NavList.Group -export type NavListGroupProps = Omit & { +export type NavListGroupProps = { children: React.ReactNode + title?: string } & SxProp const defaultSx = {}