Skip to content

Commit 42a78c1

Browse files
Bestrajoshblack
andauthored
Add pullQueued state to StateLabel (#3244)
* Add pullQueued state to StateLabel * Add snapshot for queued state * Add changeset * Correct status in docs Co-authored-by: Josh Black <[email protected]> --------- Co-authored-by: Josh Black <[email protected]>
1 parent 247cb53 commit 42a78c1

File tree

6 files changed

+70
-0
lines changed

6 files changed

+70
-0
lines changed

.changeset/happy-rings-arrive.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/react': minor
3+
---
4+
5+
Add pullQueued state to StateLabel

docs/content/StateLabel.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import data from '../../src/StateLabel/StateLabel.docs.json'
1818
<StateLabel status="pullOpened">Open</StateLabel>
1919
<StateLabel status="pullClosed">Closed</StateLabel>
2020
<StateLabel status="pullMerged">Merged</StateLabel>
21+
<StateLabel status="pullQueued">Queued</StateLabel>
2122
<StateLabel status="draft">Draft</StateLabel>
2223
<StateLabel status="issueDraft">Draft</StateLabel>
2324
</>

src/StateLabel/StateLabel.features.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export const IssueDraft = () => <StateLabel status="issueDraft">Draft</StateLabe
1616
export const PullOpened = () => <StateLabel status="pullOpened">Open</StateLabel>
1717
export const PullClosed = () => <StateLabel status="pullClosed">Closed</StateLabel>
1818
export const PullMerged = () => <StateLabel status="pullMerged">Merged</StateLabel>
19+
export const Queued = () => <StateLabel status="pullQueued">Queued</StateLabel>
1920
export const Draft = () => <StateLabel status="draft">Draft</StateLabel>
2021

2122
export const Small = () => (

src/StateLabel/StateLabel.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
IssueDraftIcon,
77
IssueOpenedIcon,
88
QuestionIcon,
9+
GitMergeQueueIcon,
910
} from '@primer/octicons-react'
1011
import React from 'react'
1112
import styled from 'styled-components'
@@ -24,6 +25,7 @@ const octiconMap = {
2425
pullMerged: GitMergeIcon,
2526
draft: GitPullRequestIcon,
2627
issueDraft: IssueDraftIcon,
28+
pullQueued: GitMergeQueueIcon,
2729
}
2830

2931
const colorVariants = variant({
@@ -45,6 +47,10 @@ const colorVariants = variant({
4547
backgroundColor: 'done.emphasis',
4648
color: 'fg.onEmphasis',
4749
},
50+
pullQueued: {
51+
backgroundColor: 'attention.emphasis',
52+
color: 'fg.onEmphasis',
53+
},
4854
issueOpened: {
4955
backgroundColor: 'open.emphasis',
5056
color: 'fg.onEmphasis',

src/StateLabel/__tests__/StateLabel.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ describe('StateLabel', () => {
3232
expect(render(<StateLabel status="issueClosed" />)).toMatchSnapshot()
3333
expect(render(<StateLabel status="issueClosedNotPlanned" />)).toMatchSnapshot()
3434
expect(render(<StateLabel status="pullMerged" />)).toMatchSnapshot()
35+
expect(render(<StateLabel status="pullQueued" />)).toMatchSnapshot()
3536
})
3637

3738
it('respects the variant prop', () => {

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

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,62 @@ exports[`StateLabel respects the status prop 4`] = `
350350
</span>
351351
`;
352352

353+
exports[`StateLabel respects the status prop 5`] = `
354+
.c1 {
355+
margin-right: 4px;
356+
}
357+
358+
.c0 {
359+
display: -webkit-inline-box;
360+
display: -webkit-inline-flex;
361+
display: -ms-inline-flexbox;
362+
display: inline-flex;
363+
-webkit-align-items: center;
364+
-webkit-box-align: center;
365+
-ms-flex-align: center;
366+
align-items: center;
367+
font-weight: 600;
368+
line-height: 16px;
369+
color: #ffffff;
370+
text-align: center;
371+
border-radius: 100px;
372+
background-color: #9a6700;
373+
color: #ffffff;
374+
padding-left: 12px;
375+
padding-right: 12px;
376+
padding-top: 8px;
377+
padding-bottom: 8px;
378+
font-size: 14px;
379+
}
380+
381+
<span
382+
className="c0"
383+
>
384+
<svg
385+
aria-hidden="true"
386+
className="c1"
387+
fill="currentColor"
388+
focusable="false"
389+
height={16}
390+
role="img"
391+
style={
392+
{
393+
"display": "inline-block",
394+
"overflow": "visible",
395+
"userSelect": "none",
396+
"verticalAlign": "text-bottom",
397+
}
398+
}
399+
viewBox="0 0 16 16"
400+
width={16}
401+
>
402+
<path
403+
d="M3.75 4.5a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5ZM3 7.75a.75.75 0 0 1 1.5 0v2.878a2.251 2.251 0 1 1-1.5 0Zm.75 5.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm5-7.75a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Zm5.75 2.5a2.25 2.25 0 1 1-4.5 0 2.25 2.25 0 0 1 4.5 0Zm-1.5 0a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Z"
404+
/>
405+
</svg>
406+
</span>
407+
`;
408+
353409
exports[`StateLabel respects the variant prop 1`] = `
354410
.c1 {
355411
margin-right: 4px;

0 commit comments

Comments
 (0)