Skip to content

Add contribution graph stories #1191

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

Merged
merged 3 commits into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from all 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/smart-plums-nail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/primitives": patch
---

Add contribution graph stories
55 changes: 54 additions & 1 deletion docs/storybook/stories/Color/Patterns/AllPatterns.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ export const Treeview = () => {
return (
<Table.Container>
<h1 className="sr-only" id="treeViewItem">
Tooltip
Treeview
</h1>
<DataTable
aria-labelledby="treeViewItem"
Expand Down Expand Up @@ -831,3 +831,56 @@ export const Treeview = () => {
</Table.Container>
)
}

export const ContributionGraph = () => {
const data = getTokensByName(colorTokens, 'contribution').map(token => {
return {
id: token.name,
...token,
}
})
return (
<Table.Container>
<h1 className="sr-only" id="contribution">
Contribution graph
</h1>
<DataTable
aria-labelledby="contribution"
data={data}
columns={[
{
header: 'Sample',
field: 'name',
rowHeader: true,
renderCell: row => {
return (
<ColorTokenSwatch
bgColor={row.name.includes('bgColor') || row.name.includes('iconColor') ? row.name : undefined}
textColor={row.name.includes('fgColor') ? row.name : undefined}
shadowColor={row.name.includes('shadow') ? row.name : undefined}
borderColor={row.name.includes('borderColor') ? row.name : undefined}
/>
)
},
},
{
header: 'Token',
field: 'name',
rowHeader: true,
renderCell: row => {
return <InlineCode value={row.name} copyClipboard cssVar />
},
},
{
header: 'Output value',
field: 'value',
rowHeader: true,
renderCell: row => {
return <p>{row.value}</p>
},
},
]}
/>
</Table.Container>
)
}