Skip to content

Commit

Permalink
Navlist passthrough action list group props (#2133)
Browse files Browse the repository at this point in the history
* passthrough actionlist group props to navlist.group

* changeset

* pass through props

* fix pass through block

* Update docs/content/NavList.mdx

* avoid passing through action list props, but spread additional props to allow aria and data attributes through

Co-authored-by: Cole Bemis <colebemis@github.com>
  • Loading branch information
mattcosta7 and colebemis committed Jun 21, 2022
1 parent c7abeb3 commit 65fcd9f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/smooth-balloons-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

Passthrough ActionList.Group props from NavList.Group
5 changes: 3 additions & 2 deletions src/NavList/NavList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,14 @@ export type NavListGroupProps = {
title?: string
} & SxProp

const defaultSx = {}
// TODO: ref prop
const Group = ({title, children, sx: sxProp = {}}: NavListGroupProps) => {
const Group: React.VFC<NavListGroupProps> = ({title, children, sx: sxProp = defaultSx, ...props}) => {
return (
<>
{/* Hide divider if the group is the first item in the list */}
<ActionList.Divider sx={{'&:first-child': {display: 'none'}}} />
<ActionList.Group title={title} sx={sxProp}>
<ActionList.Group {...props} title={title} sx={sxProp}>
{children}
</ActionList.Group>
</>
Expand Down

0 comments on commit 65fcd9f

Please sign in to comment.