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

Add 'unavailable' status to StatusLabel #3963

Merged
merged 6 commits into from
Nov 28, 2023
Merged
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
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
Loading