Skip to content

Commit

Permalink
Make StateLabel's 'status' prop required (#2993)
Browse files Browse the repository at this point in the history
* makes 'status' prop required

* adds changeset

* Update generated/components.json

* rm shouldAcceptCallWithNoProps test

---------

Co-authored-by: mperrotti <mperrotti@users.noreply.github.com>
  • Loading branch information
mperrotti and mperrotti authored Mar 15, 2023
1 parent baa6395 commit 6aa9205
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/serious-balloons-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

Makes StateLabel's 'status' prop required
3 changes: 2 additions & 1 deletion generated/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -3914,7 +3914,8 @@
},
{
"name": "status",
"type": "'issueOpened' | 'issueClosed' | 'issueClosedNotPlanned' | 'pullOpened' | 'pullClosed' | 'pullMerged' | 'draft' | 'issueDraft'"
"type": "'issueOpened' | 'issueClosed' | 'issueClosedNotPlanned' | 'pullOpened' | 'pullClosed' | 'pullMerged' | 'draft' | 'issueDraft'",
"required": true
},
{
"name": "sx",
Expand Down
3 changes: 2 additions & 1 deletion src/StateLabel/StateLabel.docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
},
{
"name": "status",
"type": "'issueOpened' | 'issueClosed' | 'issueClosedNotPlanned' | 'pullOpened' | 'pullClosed' | 'pullMerged' | 'draft' | 'issueDraft'"
"type": "'issueOpened' | 'issueClosed' | 'issueClosedNotPlanned' | 'pullOpened' | 'pullClosed' | 'pullMerged' | 'draft' | 'issueDraft'",
"required": true
},
{
"name": "sx",
Expand Down
2 changes: 1 addition & 1 deletion src/StateLabel/StateLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const sizeVariants = variant({

type StyledStateLabelBaseProps = {
variant?: 'small' | 'normal'
status?: keyof typeof octiconMap
status: keyof typeof octiconMap
} & SxProp

const StateLabelBase = styled.span<StyledStateLabelBaseProps>`
Expand Down
4 changes: 0 additions & 4 deletions src/StateLabel/__tests__/StateLabel.types.test.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import React from 'react'
import StateLabel from '../StateLabel'

export function shouldAcceptCallWithNoProps() {
return <StateLabel />
}

export function shouldNotAcceptSystemProps() {
// @ts-expect-error system props should not be accepted
return <StateLabel backgroundColor="bisque" />
Expand Down

0 comments on commit 6aa9205

Please sign in to comment.