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

Updated StateLabel to include issueClosedNotPlanned and fix issueClosed colour #2171

Merged
merged 9 commits into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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/chilly-frogs-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

Support issues closed as not planned, and correct the standard issue closed backgroud colour
11 changes: 6 additions & 5 deletions docs/content/StateLabel.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Use StateLabel components to show the status of an issue or pull request.
<>
<StateLabel status="issueOpened">Open</StateLabel>
<StateLabel status="issueClosed">Closed</StateLabel>
<StateLabel status="issueClosedNotPlanned">Closed</StateLabel>
<StateLabel status="pullOpened">Open</StateLabel>
<StateLabel status="pullClosed">Closed</StateLabel>
<StateLabel status="pullMerged">Merged</StateLabel>
Expand All @@ -22,8 +23,8 @@ Use StateLabel components to show the status of an issue or pull request.

## Component props

| Name | Type | Default | Description |
| :------ | :---------------- | :------: | :------------------------------------------------------------------------------------------------------------- |
| variant | String | 'normal' | a value of `small` or `normal` results in a smaller or larger version of the StateLabel. |
| status | String | | Can be one of `issueOpened`, `issueClosed`, `pullOpened`, `pullClosed`, `pullMerged`, `draft` or `issueDraft`. |
| sx | SystemStyleObject | {} | Style to be applied to the component |
| Name | Type | Default | Description |
| :------ | :---------------- | :------: | :-------------------------------------------------------------------------------------------------------------------------------------- |
| variant | String | 'normal' | a value of `small` or `normal` results in a smaller or larger version of the StateLabel. |
| status | String | | Can be one of `issueOpened`, `issueClosed`, `issueClosedNotPlanned`, `pullOpened`, `pullClosed`, `pullMerged`, `draft` or `issueDraft`. |
| sx | SystemStyleObject | {} | Style to be applied to the component |
8 changes: 7 additions & 1 deletion src/StateLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
GitMergeIcon,
GitPullRequestIcon,
IssueClosedIcon,
SkipIcon,
IssueDraftIcon,
IssueOpenedIcon,
QuestionIcon
Expand All @@ -18,6 +19,7 @@ const octiconMap = {
issueOpened: IssueOpenedIcon,
pullOpened: GitPullRequestIcon,
issueClosed: IssueClosedIcon,
issueClosedNotPlanned: SkipIcon,
pullClosed: GitPullRequestIcon,
pullMerged: GitMergeIcon,
draft: GitPullRequestIcon,
Expand All @@ -28,7 +30,11 @@ const colorVariants = variant({
prop: 'status',
variants: {
issueClosed: {
backgroundColor: 'danger.emphasis',
backgroundColor: 'done.emphasis',
color: 'fg.onEmphasis'
},
issueClosedNotPlanned: {
backgroundColor: 'neutral.emphasis',
color: 'fg.onEmphasis'
},
pullClosed: {
Expand Down