Skip to content

Commit dc11323

Browse files
committed
Pagination no longer accepts styled system props
1 parent 94c6122 commit dc11323

File tree

4 files changed

+29
-24
lines changed

4 files changed

+29
-24
lines changed

.changeset/spicy-olives-lick.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+
Pagination 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/Pagination.md

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -127,27 +127,18 @@ To hide all the page numbers and create a simple pagination container with just
127127
</State>
128128
```
129129

130-
## System props
131-
132-
<Note variant="warning">
133-
134-
System props are deprecated in all components except [Box](/Box). Please use the [`sx` prop](/overriding-styles) instead.
135-
136-
</Note>
137-
138-
Pagination components get `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props.
139-
140130
## Component props
141131

142-
| Name | Type | Default | Description |
143-
| :------------------- | :------- | :--------: | :--------------------------------------------------------------------- |
144-
| currentPage | Number | | **Required.** The currently selected page. |
145-
| hrefBuilder | Function | `#${page}` | A function to generate links based on page number. |
146-
| marginPageCount | Number | 1 | How many pages to always show at the left and right of the component. |
147-
| onPageChange | Function | no-op | Called with event and page number when a page is clicked. |
148-
| pageCount | Number | | **Required.** The total number of pages. |
149-
| showPages | Boolean | `true` | Whether or not to show the individual page links. |
150-
| surroundingPageCount | Number | 2 | How many pages to display on each side of the currently selected page. |
132+
| Name | Type | Default | Description |
133+
| :------------------- | :---------------- | :--------: | :--------------------------------------------------------------------- |
134+
| currentPage | Number | | **Required.** The currently selected page. |
135+
| hrefBuilder | Function | `#${page}` | A function to generate links based on page number. |
136+
| marginPageCount | Number | 1 | How many pages to always show at the left and right of the component. |
137+
| onPageChange | Function | no-op | Called with event and page number when a page is clicked. |
138+
| pageCount | Number | | **Required.** The total number of pages. |
139+
| showPages | Boolean | `true` | Whether or not to show the individual page links. |
140+
| surroundingPageCount | Number | 2 | How many pages to display on each side of the currently selected page. |
141+
| sx | SystemStyleObject | {} | Style to be applied to the component |
151142

152143
## Theming
153144

src/Pagination/Pagination.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from 'react'
22
import styled from 'styled-components'
33
import Box from '../Box'
4-
import {COMMON, get} from '../constants'
5-
import sx from '../sx'
4+
import {get} from '../constants'
5+
import sx, {SxProp} from '../sx'
66
import {buildComponentData, buildPaginationModel} from './model'
77

88
const Page = styled.a`
@@ -103,8 +103,6 @@ const Page = styled.a`
103103
);
104104
}
105105
}
106-
107-
${COMMON};
108106
`
109107

110108
type UsePaginationPagesParameters = {
@@ -148,7 +146,7 @@ function usePaginationPages({
148146
return children
149147
}
150148

151-
const PaginationContainer = styled.nav`
149+
const PaginationContainer = styled.nav<SxProp>`
152150
margin-top: 20px;
153151
margin-bottom: 15px;
154152
text-align: center;
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 Pagination from '../Pagination'
3+
4+
export function shouldAcceptCallWithNoProps() {
5+
return <Pagination currentPage={1} pageCount={2} />
6+
}
7+
8+
export function shouldNotAcceptSystemProps() {
9+
// @ts-expect-error system props should not be accepted
10+
return <Pagination currentPage={1} pageCount={2} backgroundColor="palegoldenrod" />
11+
}

0 commit comments

Comments
 (0)