diff --git a/.changeset/chilly-socks-compare.md b/.changeset/chilly-socks-compare.md new file mode 100644 index 00000000000..79f100bcc6f --- /dev/null +++ b/.changeset/chilly-socks-compare.md @@ -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. diff --git a/docs/content/Pagehead.md b/docs/content/Pagehead.md index 2e24a3ea516..aed51c8ec47 100644 --- a/docs/content/Pagehead.md +++ b/docs/content/Pagehead.md @@ -10,18 +10,9 @@ Give a page a clear, separated title and optional top nav by using Pagehead. Pagehead ``` -## System props - - - -System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead. - - - -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 | diff --git a/src/Pagehead.tsx b/src/Pagehead.tsx index 85f44c2330f..3ea6425535e 100644 --- a/src/Pagehead.tsx +++ b/src/Pagehead.tsx @@ -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` +const Pagehead = styled.div` 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}; ` diff --git a/src/__tests__/Pagehead.types.test.tsx b/src/__tests__/Pagehead.types.test.tsx new file mode 100644 index 00000000000..eb6593c2afd --- /dev/null +++ b/src/__tests__/Pagehead.types.test.tsx @@ -0,0 +1,11 @@ +import React from 'react' +import Pagehead from '../Pagehead' + +export function shouldAcceptCallWithNoProps() { + return +} + +export function shouldNotAcceptSystemProps() { + // @ts-expect-error system props should not be accepted + return +}