Skip to content
Draft
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/early-dragons-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': minor
---

StateLabel: Add support for new Pull Request "unlisted" state
5 changes: 4 additions & 1 deletion packages/react/src/StateLabel/StateLabel.docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
{
"id": "components-statelabel-features--draft"
},
{
"id": "components-statelabel-features--unlisted"
},
{
"id": "components-statelabel-features--unavailable"
},
Expand All @@ -56,7 +59,7 @@
},
{
"name": "status",
"type": "'issueOpened' | 'issueClosed' | 'issueClosedNotPlanned' | 'pullOpened' | 'pullClosed' | 'pullMerged' | 'draft' | 'issueDraft' | 'unavailable' | 'open' | 'closed'",
"type": "'issueOpened' | 'issueClosed' | 'issueClosedNotPlanned' | 'pullOpened' | 'pullClosed' | 'pullMerged' | 'draft' | 'pullUnlisted' | 'issueDraft' | 'unavailable' | 'open' | 'closed'",
"required": true
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const Open = () => (
</StateLabel>
)
export const Closed = () => <StateLabel status="closed">Closed</StateLabel>
export const Unlisted = () => <StateLabel status="pullUnlisted">Unlisted</StateLabel>

export const Small = () => (
<StateLabel status="issueOpened" variant="small">
Expand Down
7 changes: 7 additions & 0 deletions packages/react/src/StateLabel/StateLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const octiconMap = {
pullClosed: GitPullRequestClosedIcon,
pullMerged: GitMergeIcon,
draft: GitPullRequestDraftIcon,
pullUnlisted: GitPullRequestDraftIcon, // TODO: update with GitPullRequestUnlistedIcon once Octicon is updated
issueDraft: IssueDraftIcon,
pullQueued: GitMergeQueueIcon,
unavailable: AlertIcon,
Expand All @@ -42,6 +43,7 @@ const labelMap: Record<keyof typeof octiconMap, 'Issue' | 'Issue, not planned' |
pullClosed: 'Pull request',
pullMerged: 'Pull request',
draft: 'Pull request',
pullUnlisted: 'Pull request',
issueDraft: 'Issue',
pullQueued: 'Pull request',
unavailable: '',
Expand Down Expand Up @@ -92,6 +94,11 @@ const colorVariants = variant({
color: 'fg.onEmphasis',
boxShadow: 'var(--boxShadow-thin, inset 0 0 0 1px) var(--borderColor-neutral-emphasis, transparent)',
},
pullUnlisted: {
backgroundColor: 'neutral.muted', // --bgColor-muted not available here?
color: 'fg.muted',
boxShadow: 'var(--boxShadow-thin, inset 0 0 0 1px) var(--borderColor-default, transparent)',
},
issueDraft: {
backgroundColor: 'neutral.emphasis',
color: 'fg.onEmphasis',
Expand Down
Loading