Skip to content

Commit 01ee252

Browse files
committed
CounterLabel no longer accepts styled system props (#1557)
1 parent 5a25ecb commit 01ee252

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
lines changed

.changeset/unlucky-snails-pull.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/components': major
3+
---
4+
5+
CounterLabel no longer accepts styled-system props. Please use the `sx` prop to extend Primer component styling instead. See also https://primer.style/react/overriding-styles for information about `sx` and https://primer.style/react/system-props for context on the removal.

docs/content/CounterLabel.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,6 @@ Use the CounterLabel component to add a count to navigational elements and butto
1515
</>
1616
```
1717

18-
## System props
19-
20-
<Note variant="warning">
21-
22-
System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead.
23-
24-
</Note>
25-
26-
CounterLabel components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props.
27-
2818
## Component props
2919

3020
| Name | Type | Default | Description |

src/CounterLabel.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import styled from 'styled-components'
2-
import {COMMON, get, SystemCommonProps} from './constants'
2+
import {get} from './constants'
33
import sx, {SxProp} from './sx'
44
import {ComponentProps} from './utils/types'
55

66
type StyledCounterLabelProps = {
77
scheme?: 'primary' | 'secondary'
8-
} & SystemCommonProps &
9-
SxProp
8+
} & SxProp
109

1110
const colorStyles = ({scheme, ...props}: StyledCounterLabelProps) => {
1211
return {
@@ -39,7 +38,6 @@ const CounterLabel = styled.span<StyledCounterLabelProps>`
3938
border-radius: 20px;
4039
${colorStyles};
4140
${bgStyles};
42-
${COMMON};
4341
4442
&:empty {
4543
display: none;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react'
2+
import CounterLabel from '../CounterLabel'
3+
4+
export function shouldAcceptCallWithNoProps() {
5+
return <CounterLabel />
6+
}
7+
8+
export function shouldNotAcceptSystemProps() {
9+
// @ts-expect-error system props should not be accepted
10+
return <CounterLabel backgroundColor="whitesmoke" />
11+
}

0 commit comments

Comments
 (0)