Skip to content
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
5 changes: 5 additions & 0 deletions .changeset/unlucky-snails-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/components': major
---

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.
10 changes: 0 additions & 10 deletions docs/content/CounterLabel.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@ Use the CounterLabel component to add a count to navigational elements and butto
</>
```

## System props

<Note variant="warning">

System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead.

</Note>

CounterLabel components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props.

## Component props

| Name | Type | Default | Description |
Expand Down
6 changes: 2 additions & 4 deletions src/CounterLabel.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import styled from 'styled-components'
import {COMMON, get, SystemCommonProps} from './constants'
import {get} from './constants'
import sx, {SxProp} from './sx'
import {ComponentProps} from './utils/types'

type StyledCounterLabelProps = {
scheme?: 'primary' | 'secondary'
} & SystemCommonProps &
SxProp
} & SxProp

const colorStyles = ({scheme, ...props}: StyledCounterLabelProps) => {
return {
Expand Down Expand Up @@ -39,7 +38,6 @@ const CounterLabel = styled.span<StyledCounterLabelProps>`
border-radius: 20px;
${colorStyles};
${bgStyles};
${COMMON};

&:empty {
display: none;
Expand Down
11 changes: 11 additions & 0 deletions src/__tests__/CounterLabel.types.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react'
import CounterLabel from '../CounterLabel'

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

export function shouldNotAcceptSystemProps() {
// @ts-expect-error system props should not be accepted
return <CounterLabel backgroundColor="whitesmoke" />
}