Skip to content

Commit 4149ed5

Browse files
committed
Pagehead no longer accepts styled system props (#1568)
1 parent 028a5e7 commit 4149ed5

File tree

4 files changed

+22
-16
lines changed

4 files changed

+22
-16
lines changed

.changeset/chilly-socks-compare.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+
Pagehead 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/Pagehead.md

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,9 @@ Give a page a clear, separated title and optional top nav by using Pagehead.
1010
<Pagehead>Pagehead</Pagehead>
1111
```
1212

13-
## System props
14-
15-
<Note variant="warning">
16-
17-
System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead.
18-
19-
</Note>
20-
21-
Pagehead components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props.
22-
2313
## Component props
2414

25-
| Name | Type | Default | Description |
26-
| :--- | :----- | :-----: | :---------------------------------- |
27-
| as | String | `div` | Sets the HTML tag for the component |
15+
| Name | Type | Default | Description |
16+
| :--- | :---------------- | :-----: | :----------------------------------- |
17+
| as | String | `div` | Sets the HTML tag for the component |
18+
| sx | SystemStyleObject | {} | Style to be applied to the component |

src/Pagehead.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
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

6-
const Pagehead = styled.div<SystemCommonProps & SxProp>`
6+
const Pagehead = styled.div<SxProp>`
77
position: relative;
88
padding-top: ${get('space.4')};
99
padding-bottom: ${get('space.4')};
1010
margin-bottom: ${get('space.4')};
1111
border-bottom: 1px solid ${get('colors.border.default')};
12-
${COMMON};
1312
${sx};
1413
`
1514

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 Pagehead from '../Pagehead'
3+
4+
export function shouldAcceptCallWithNoProps() {
5+
return <Pagehead />
6+
}
7+
8+
export function shouldNotAcceptSystemProps() {
9+
// @ts-expect-error system props should not be accepted
10+
return <Pagehead backgroundColor="orchid" />
11+
}

0 commit comments

Comments
 (0)