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

feat(Pagination): Remove sxProp #5429

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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/stale-frogs-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": major
---

Remove sxProp from Pagination
4 changes: 4 additions & 0 deletions packages/react/src/Pagination/Pagination.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@
text-align: center;
}

.TablePaginationSteps {
display: inline-block;
}

@media screen and (--viewportRange-narrow) {
.TablePaginationSteps[data-hidden-viewport-ranges*='narrow'] > *:not(:first-child):not(:last-child) {
display: none;
Expand Down
13 changes: 3 additions & 10 deletions packages/react/src/Pagination/Pagination.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import React from 'react'
import styled from 'styled-components'
import Box from '../Box'
import {get} from '../constants'
import type {SxProp} from '../sx'
import sx from '../sx'
import {buildComponentData, buildPaginationModel} from './model'
import type {ResponsiveValue} from '../hooks/useResponsiveValue'
import {viewportRanges} from '../hooks/useResponsiveValue'
Expand Down Expand Up @@ -201,7 +198,7 @@ function usePaginationPages({
const PaginationContainer = toggleStyledComponent(
CSS_MODULES_FEATURE_FLAG,
'nav',
styled.nav<SxProp>`
styled.nav`
margin-top: 20px;
margin-bottom: 15px;
text-align: center;
Expand All @@ -228,8 +225,6 @@ const PaginationContainer = toggleStyledComponent(
})
.join('')
}

${sx};
`,
)

Expand Down Expand Up @@ -275,14 +270,12 @@ function Pagination({
{...rest}
theme={theme}
>
<Box
display="inline-block"
theme={theme}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if theme is still used here anymore

<div
className={classes.TablePaginationSteps}
data-hidden-viewport-ranges={getViewportRangesToHidePages(showPages).join(' ')}
>
{pageElements}
</Box>
</div>
</PaginationContainer>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const reqProps = {pageCount: 10, currentPage: 1}
const comp = <Pagination {...reqProps} />

describe('Pagination', () => {
behavesAsComponent({Component: Pagination, toRender: () => comp})
behavesAsComponent({Component: Pagination, toRender: () => comp, options: {skipSx: true}})

it('should have no axe violations', async () => {
const {container} = HTMLRender(comp)
Expand Down
Loading