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

NavList: Fix group dividers #3328

Merged
merged 3 commits into from
May 25, 2023
Merged
Changes from 1 commit
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
14 changes: 8 additions & 6 deletions src/NavList/NavList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,16 @@ const defaultSx = {}
// TODO: ref prop
const Group: React.FC<NavListGroupProps> = ({title, children, sx: sxProp = defaultSx, ...props}) => {
return (
<Box as="li" sx={sxProp} {...props}>
<>
{/* Hide divider if the group is the first item in the list */}
<ActionList.Divider as="div" sx={{'&:first-child': {display: 'none'}}} />
{title && <ActionList.Heading title={title} />}
<Box as="ul" sx={{paddingInlineStart: 0}}>
{children}
<ActionList.Divider sx={{'&:first-child': {display: 'none'}}} />
<Box as="li" sx={sxProp} {...props}>
{title && <ActionList.Heading title={title} />}
<Box as="ul" sx={{paddingInlineStart: 0}}>
{children}
</Box>
</Box>
</Box>
</>
)
}

Expand Down