Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagehead no longer accepts styled system props #1568

Merged
merged 1 commit into from
Nov 16, 2021
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/chilly-socks-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/components': major
---

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.
17 changes: 4 additions & 13 deletions docs/content/Pagehead.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,9 @@ Give a page a clear, separated title and optional top nav by using Pagehead.
<Pagehead>Pagehead</Pagehead>
```

## System props

<Note variant="warning">

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

</Note>

Pagehead 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 |
| :--- | :----- | :-----: | :---------------------------------- |
| as | String | `div` | Sets the HTML tag for the component |
| Name | Type | Default | Description |
| :--- | :---------------- | :-----: | :----------------------------------- |
| as | String | `div` | Sets the HTML tag for the component |
| sx | SystemStyleObject | {} | Style to be applied to the component |
5 changes: 2 additions & 3 deletions src/Pagehead.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
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'

const Pagehead = styled.div<SystemCommonProps & SxProp>`
const Pagehead = styled.div<SxProp>`
position: relative;
padding-top: ${get('space.4')};
padding-bottom: ${get('space.4')};
margin-bottom: ${get('space.4')};
border-bottom: 1px solid ${get('colors.border.default')};
${COMMON};
${sx};
`

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

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

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