Skip to content

Commit d2090b5

Browse files
authored
Add support for draft issues to the StateLabel component (#1604)
* add support for draft issues to the StateLabel component
1 parent f4057b8 commit d2090b5

16 files changed

+139
-20
lines changed

.changeset/state-label-draft-issue.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/components": patch
3+
---
4+
5+
Add support for draft issues to the StateLabel component

docs/content/StateLabel.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Use StateLabel components to show the status of an issue or pull request.
1414
<StateLabel status="pullClosed">Closed</StateLabel>
1515
<StateLabel status="pullMerged">Merged</StateLabel>
1616
<StateLabel status="draft">Draft</StateLabel>
17+
<StateLabel status="issueDraft">Draft</StateLabel>
1718
</>
1819
```
1920

@@ -29,7 +30,7 @@ StateLabel components get `COMMON` system props. Read our [System Props](/system
2930

3031
## Component props
3132

32-
| Name | Type | Default | Description |
33-
| :------ | :----- | :------: | :------------------------------------------------------------------------------------------------ |
34-
| variant | String | 'normal' | a value of `small` or `normal` results in a smaller or larger version of the StateLabel. |
35-
| status | String | | Can be one of `issueOpened`, `issueClosed`, `pullOpened`, `pullClosed`, `pullMerged`, or `draft`. |
33+
| Name | Type | Default | Description |
34+
| :------ | :----- | :------: | :------------------------------------------------------------------------------------------------------------- |
35+
| variant | String | 'normal' | a value of `small` or `normal` results in a smaller or larger version of the StateLabel. |
36+
| status | String | | Can be one of `issueOpened`, `issueClosed`, `pullOpened`, `pullClosed`, `pullMerged`, `draft` or `issueDraft`. |

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"author": "GitHub, Inc.",
4444
"license": "MIT",
4545
"dependencies": {
46-
"@primer/octicons-react": "^13.0.0",
46+
"@primer/octicons-react": "^16.1.0",
4747
"@primer/primitives": "6.1.0",
4848
"@radix-ui/react-polymorphic": "0.0.14",
4949
"@react-aria/ssr": "3.1.0",

src/StateLabel.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
import {GitMergeIcon, GitPullRequestIcon, IssueClosedIcon, IssueOpenedIcon, QuestionIcon} from '@primer/octicons-react'
1+
import {
2+
GitMergeIcon,
3+
GitPullRequestIcon,
4+
IssueClosedIcon,
5+
IssueDraftIcon,
6+
IssueOpenedIcon,
7+
QuestionIcon
8+
} from '@primer/octicons-react'
29
import React from 'react'
310
import styled from 'styled-components'
411
import {variant} from 'styled-system'
@@ -13,7 +20,8 @@ const octiconMap = {
1320
issueClosed: IssueClosedIcon,
1421
pullClosed: GitPullRequestIcon,
1522
pullMerged: GitMergeIcon,
16-
draft: GitPullRequestIcon
23+
draft: GitPullRequestIcon,
24+
issueDraft: IssueDraftIcon
1725
}
1826

1927
const colorVariants = variant({
@@ -42,6 +50,10 @@ const colorVariants = variant({
4250
draft: {
4351
backgroundColor: 'neutral.emphasis',
4452
color: 'fg.onEmphasis'
53+
},
54+
issueDraft: {
55+
backgroundColor: 'neutral.emphasis',
56+
color: 'fg.onEmphasis'
4557
}
4658
}
4759
})

src/__tests__/__snapshots__/Autocomplete.test.tsx.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,7 @@ Array [
972972
style={
973973
Object {
974974
"display": "inline-block",
975+
"overflow": "visible",
975976
"userSelect": "none",
976977
"verticalAlign": "text-bottom",
977978
}

src/__tests__/__snapshots__/CircleBadge.test.tsx.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ exports[`CircleBadge CircleBadge.Icon renders consistently 1`] = `
2121
style={
2222
Object {
2323
"display": "inline-block",
24+
"overflow": "visible",
2425
"userSelect": "none",
2526
"verticalAlign": "text-bottom",
2627
}

src/__tests__/__snapshots__/CircleOcticon.test.tsx.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ exports[`CircleOcticon renders consistently 1`] = `
5252
style={
5353
Object {
5454
"display": "inline-block",
55+
"overflow": "visible",
5556
"userSelect": "none",
5657
"verticalAlign": "text-bottom",
5758
}

src/__tests__/__snapshots__/Dialog.test.tsx.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ Array [
163163
style={
164164
Object {
165165
"display": "inline-block",
166+
"overflow": "visible",
166167
"userSelect": "none",
167168
"verticalAlign": "text-bottom",
168169
}

src/__tests__/__snapshots__/DropdownMenu.test.tsx.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ exports[`DropdownMenu renders consistently 1`] = `
9595
style={
9696
Object {
9797
"display": "inline-block",
98+
"overflow": "visible",
9899
"userSelect": "none",
99100
"verticalAlign": "text-bottom",
100101
}

0 commit comments

Comments
 (0)