Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 5 additions & 0 deletions .changeset/happy-clocks-cover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": minor
---

feat(NavList): add support for inline and block description
4 changes: 4 additions & 0 deletions e2e/components/NavList.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ const stories = [
title: 'With group expand',
id: 'components-navlist-features--with-group-expand',
},
{
title: 'With Description',
id: 'components-navlist-dev--with-description',
Comment thread
francinelucca marked this conversation as resolved.
Outdated
},
]

test.describe('NavList', () => {
Expand Down
28 changes: 28 additions & 0 deletions packages/react/src/NavList/NavList.docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{"id": "components-navlist-features--expand-with-custom-items"},
{"id": "components-navlist-features--expand-with-pages"},
{"id": "components-navlist-features--group-with-expand-and-custom-items"},
{"id": "components-navlist-features--with-description"},
{"id": "components-navlist-features--with-expand"},
{"id": "components-navlist-features--with-expand-and-icons"},
{"id": "components-navlist-features--with-group"},
Expand Down Expand Up @@ -88,6 +89,33 @@
"url": "https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#Attributes"
}
},
{
"name": "NavList.Description",
"props": [
{
"name": "variant",
"type": "'inline' | 'block'",
"defaultValue": "'inline'",
"description": "`inline` descriptions are positioned beside primary text. `block` descriptions are positioned below primary text."
},
{
"name": "truncate",
"type": "boolean",
"defaultValue": "false",
"description": "Whether the inline description should truncate the text on overflow."
},
{
"name": "className",
"type": "string",
"description": "Custom CSS class name."
},
{
"name": "style",
"type": "React.CSSProperties",
"description": "Custom CSS styles."
}
]
},
{
"name": "NavList.LeadingVisual",
"props": [
Expand Down
45 changes: 45 additions & 0 deletions packages/react/src/NavList/NavList.features.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -576,4 +576,49 @@ export const GroupWithExpandAndCustomItems = () => {
)
}

export const WithDescription: StoryFn = () => (
<NavList>
<NavList.Item href="#" aria-current="page">
<NavList.LeadingVisual>
<RepoIcon />
</NavList.LeadingVisual>
Main Repository
<NavList.Description>Primary project repository</NavList.Description>
</NavList.Item>
<NavList.Item href="#">
<NavList.LeadingVisual>
<BookIcon />
</NavList.LeadingVisual>
Documentation
<NavList.Description>User guides and API documentation</NavList.Description>
</NavList.Item>
<NavList.Item href="#">
<NavList.LeadingVisual>
<IssueOpenedIcon />
</NavList.LeadingVisual>
Bug Reports
<NavList.Description variant="block">
Submit and track bug reports for the project. Include detailed steps to reproduce, expected behavior, and system
information.
</NavList.Description>
</NavList.Item>
<NavList.Item href="#">
<NavList.LeadingVisual>
<PeopleIcon />
</NavList.LeadingVisual>
Community
<NavList.Description variant="block">
Connect with other developers, share ideas, and collaborate on features and improvements.
</NavList.Description>
</NavList.Item>
<NavList.Item href="#">
<NavList.LeadingVisual>
<GitCommitIcon />
</NavList.LeadingVisual>
Recent Changes
<NavList.Description>Latest commits and releases</NavList.Description>
</NavList.Item>
</NavList>
)

export default meta
1 change: 1 addition & 0 deletions packages/react/src/NavList/NavList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ const GroupHeading: React.FC<NavListGroupHeadingProps> = ({as = 'h3', className,
// Export

export const NavList = Object.assign(Root, {
Description: ActionList.Description,
Item,
SubNav,
LeadingVisual,
Expand Down
Loading