Skip to content

Commit

Permalink
Add 'unavailable' status to StatusLabel (#3963)
Browse files Browse the repository at this point in the history
* adds unavailable status to StateLabel

* adds changeset

* updates StateLabel docs with 'unavailable'

* test(vrt): update snapshots

---------

Co-authored-by: mperrotti <[email protected]>
Co-authored-by: Pavithra Kodmad <[email protected]>
  • Loading branch information
3 people authored Nov 28, 2023
1 parent 32d2487 commit e16927b
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .changeset/nervous-tomatoes-bow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@primer/react': minor
---

Adds "unavailable" status to StateLabel

<!-- Changed components: StateLabel -->
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions e2e/components/StateLabel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,33 @@ test.describe('StateLabel', () => {
}
})

test.describe('Unavailable', () => {
for (const theme of themes) {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'components-statelabel-features--unavailable',
globals: {
colorScheme: theme,
},
})

// Default state
expect(await page.screenshot()).toMatchSnapshot(`StateLabel.Unavailable.${theme}.png`)
})

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'components-statelabel-features--unavailable',
globals: {
colorScheme: theme,
},
})
})
})
}
})

test.describe('Small', () => {
for (const theme of themes) {
test.describe(theme, () => {
Expand Down
2 changes: 1 addition & 1 deletion src/StateLabel/StateLabel.docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
{
"name": "status",
"type": "'issueOpened' | 'issueClosed' | 'issueClosedNotPlanned' | 'pullOpened' | 'pullClosed' | 'pullMerged' | 'draft' | 'issueDraft'",
"type": "'issueOpened' | 'issueClosed' | 'issueClosedNotPlanned' | 'pullOpened' | 'pullClosed' | 'pullMerged' | 'draft' | 'issueDraft' | 'unavailable'",
"required": true
},
{
Expand Down
1 change: 1 addition & 0 deletions src/StateLabel/StateLabel.features.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const PullClosed = () => <StateLabel status="pullClosed">Closed</StateLab
export const PullMerged = () => <StateLabel status="pullMerged">Merged</StateLabel>
export const Queued = () => <StateLabel status="pullQueued">Queued</StateLabel>
export const Draft = () => <StateLabel status="draft">Draft</StateLabel>
export const Unavailable = () => <StateLabel status="unavailable">Unavailable</StateLabel>

export const Small = () => (
<StateLabel status="issueOpened" variant="small">
Expand Down
6 changes: 6 additions & 0 deletions src/StateLabel/StateLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
IssueOpenedIcon,
QuestionIcon,
GitMergeQueueIcon,
AlertIcon,
} from '@primer/octicons-react'
import React from 'react'
import styled from 'styled-components'
Expand All @@ -26,6 +27,7 @@ const octiconMap = {
draft: GitPullRequestIcon,
issueDraft: IssueDraftIcon,
pullQueued: GitMergeQueueIcon,
unavailable: AlertIcon,
}

const colorVariants = variant({
Expand Down Expand Up @@ -67,6 +69,10 @@ const colorVariants = variant({
backgroundColor: 'neutral.emphasis',
color: 'fg.onEmphasis',
},
unavailable: {
backgroundColor: 'neutral.emphasis',
color: 'fg.onEmphasis',
},
},
})

Expand Down

0 comments on commit e16927b

Please sign in to comment.