Skip to content

Commit 3a778b9

Browse files
authored
Remove sxProp support from StateLabel component (#6656)
1 parent 3d25154 commit 3a778b9

File tree

6 files changed

+28
-33
lines changed

6 files changed

+28
-33
lines changed

.changeset/tricky-eggs-cross.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/react': major
3+
---
4+
5+
Update StateLabel component to no longer support sx.

packages/react/src/StateLabel/StateLabel.docs.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,7 @@
5858
"name": "status",
5959
"type": "'issueOpened' | 'issueClosed' | 'issueClosedNotPlanned' | 'pullOpened' | 'pullClosed' | 'pullMerged' | 'draft' | 'issueDraft' | 'unavailable' | 'open' | 'closed'",
6060
"required": true
61-
},
62-
{
63-
"name": "sx",
64-
"type": "SystemStyleObject",
65-
"deprecated": true
6661
}
6762
],
6863
"subcomponents": []
69-
}
64+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.Icon {
2+
margin-right: var(--base-size-4);
3+
}

packages/react/src/StateLabel/StateLabel.stories.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ Playground.argTypes = {
2222
disable: true,
2323
},
2424
},
25-
sx: {
26-
controls: false,
27-
table: {
28-
disable: true,
29-
},
30-
},
3125
theme: {
3226
controls: false,
3327
table: {

packages/react/src/StateLabel/StateLabel.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ import styled from 'styled-components'
1515
import {variant} from 'styled-system'
1616
import {get} from '../constants'
1717
import Octicon from '../Octicon'
18-
import type {SxProp} from '../sx'
19-
import sx from '../sx'
2018
import type {ComponentProps} from '../utils/types'
19+
import classes from './StateLabel.module.css'
2120

2221
const octiconMap = {
2322
issueOpened: IssueOpenedIcon,
@@ -134,7 +133,7 @@ const sizeVariants = variant({
134133
type StyledStateLabelBaseProps = {
135134
variant?: 'small' | 'normal'
136135
status: keyof typeof octiconMap
137-
} & SxProp
136+
}
138137

139138
const StateLabelBase = styled.span<StyledStateLabelBaseProps>`
140139
display: inline-flex;
@@ -146,7 +145,6 @@ const StateLabelBase = styled.span<StyledStateLabelBaseProps>`
146145
border-radius: ${get('radii.3')};
147146
${colorVariants};
148147
${sizeVariants};
149-
${sx};
150148
`
151149

152150
export type StateLabelProps = ComponentProps<typeof StateLabelBase>
@@ -164,7 +162,7 @@ function StateLabel({children, status, variant: variantProp = 'normal', ...rest}
164162
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
165163
icon={octiconMap[status] || QuestionIcon}
166164
aria-label={labelMap[status]}
167-
sx={{mr: 1}}
165+
className={classes.Icon}
168166
/>
169167
)}
170168
{children}

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
exports[`StateLabel > renders children 1`] = `
44
<div>
55
<span
6-
class="sc-gEvEer kMFJqD"
6+
class="sc-gEvEer kZGRsh"
77
>
88
<svg
99
aria-label="Issue"
10-
class="octicon octicon-issue-opened sc-aXZVg iIIuCH"
10+
class="octicon octicon-issue-opened sc-aXZVg fRzBGV prc-StateLabel-Icon-UdR1Y"
1111
display="inline-block"
1212
fill="currentColor"
1313
focusable="false"
@@ -33,11 +33,11 @@ exports[`StateLabel > renders children 1`] = `
3333
exports[`StateLabel > respects the status prop 1`] = `
3434
<div>
3535
<span
36-
class="sc-gEvEer kMFJqD"
36+
class="sc-gEvEer kZGRsh"
3737
>
3838
<svg
3939
aria-label="Issue"
40-
class="octicon octicon-issue-opened sc-aXZVg iIIuCH"
40+
class="octicon octicon-issue-opened sc-aXZVg fRzBGV prc-StateLabel-Icon-UdR1Y"
4141
display="inline-block"
4242
fill="currentColor"
4343
focusable="false"
@@ -62,11 +62,11 @@ exports[`StateLabel > respects the status prop 1`] = `
6262
exports[`StateLabel > respects the status prop 2`] = `
6363
<div>
6464
<span
65-
class="sc-gEvEer bsjviD"
65+
class="sc-gEvEer ccfZZ"
6666
>
6767
<svg
6868
aria-label="Issue"
69-
class="octicon octicon-issue-closed sc-aXZVg iIIuCH"
69+
class="octicon octicon-issue-closed sc-aXZVg fRzBGV prc-StateLabel-Icon-UdR1Y"
7070
display="inline-block"
7171
fill="currentColor"
7272
focusable="false"
@@ -91,11 +91,11 @@ exports[`StateLabel > respects the status prop 2`] = `
9191
exports[`StateLabel > respects the status prop 3`] = `
9292
<div>
9393
<span
94-
class="sc-gEvEer fTounP"
94+
class="sc-gEvEer cIcgsx"
9595
>
9696
<svg
9797
aria-label="Issue, not planned"
98-
class="octicon octicon-skip sc-aXZVg iIIuCH"
98+
class="octicon octicon-skip sc-aXZVg fRzBGV prc-StateLabel-Icon-UdR1Y"
9999
display="inline-block"
100100
fill="currentColor"
101101
focusable="false"
@@ -117,11 +117,11 @@ exports[`StateLabel > respects the status prop 3`] = `
117117
exports[`StateLabel > respects the status prop 4`] = `
118118
<div>
119119
<span
120-
class="sc-gEvEer bsjviD"
120+
class="sc-gEvEer ccfZZ"
121121
>
122122
<svg
123123
aria-label="Pull request"
124-
class="octicon octicon-git-merge sc-aXZVg iIIuCH"
124+
class="octicon octicon-git-merge sc-aXZVg fRzBGV prc-StateLabel-Icon-UdR1Y"
125125
display="inline-block"
126126
fill="currentColor"
127127
focusable="false"
@@ -143,11 +143,11 @@ exports[`StateLabel > respects the status prop 4`] = `
143143
exports[`StateLabel > respects the status prop 5`] = `
144144
<div>
145145
<span
146-
class="sc-gEvEer kAzWGT"
146+
class="sc-gEvEer dDPQZd"
147147
>
148148
<svg
149149
aria-label="Pull request"
150-
class="octicon octicon-git-merge-queue sc-aXZVg iIIuCH"
150+
class="octicon octicon-git-merge-queue sc-aXZVg fRzBGV prc-StateLabel-Icon-UdR1Y"
151151
display="inline-block"
152152
fill="currentColor"
153153
focusable="false"
@@ -169,11 +169,11 @@ exports[`StateLabel > respects the status prop 5`] = `
169169
exports[`StateLabel > respects the variant prop 1`] = `
170170
<div>
171171
<span
172-
class="sc-gEvEer bDjmot"
172+
class="sc-gEvEer lpakhT"
173173
>
174174
<svg
175175
aria-label="Issue"
176-
class="octicon octicon-issue-opened sc-aXZVg iIIuCH"
176+
class="octicon octicon-issue-opened sc-aXZVg fRzBGV prc-StateLabel-Icon-UdR1Y"
177177
display="inline-block"
178178
fill="currentColor"
179179
focusable="false"
@@ -198,11 +198,11 @@ exports[`StateLabel > respects the variant prop 1`] = `
198198
exports[`StateLabel > respects the variant prop 2`] = `
199199
<div>
200200
<span
201-
class="sc-gEvEer kMFJqD"
201+
class="sc-gEvEer kZGRsh"
202202
>
203203
<svg
204204
aria-label="Issue"
205-
class="octicon octicon-issue-opened sc-aXZVg iIIuCH"
205+
class="octicon octicon-issue-opened sc-aXZVg fRzBGV prc-StateLabel-Icon-UdR1Y"
206206
display="inline-block"
207207
fill="currentColor"
208208
focusable="false"

0 commit comments

Comments
 (0)