Skip to content

Commit

Permalink
[FX-5654] Migrate Pagination to TailwindCSS (#4496)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianContiu authored Aug 22, 2024
1 parent b9aee47 commit 1c2648f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 25 deletions.
6 changes: 6 additions & 0 deletions .changeset/nasty-avocados-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@toptal/picasso-pagination': patch
---

- migrate Pagination to TailwindCSS
- remove peer dependency on `@material-ui/core`
4 changes: 1 addition & 3 deletions packages/base/Pagination/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@
"@toptal/picasso-button": "3.0.10",
"@toptal/picasso-container": "2.0.0",
"@toptal/picasso-typography": "3.0.0",
"@toptal/picasso-utils": "1.0.3",
"classnames": "^2.5.1"
"@toptal/picasso-utils": "1.0.3"
},
"sideEffects": [
"**/styles.ts",
"**/styles.js"
],
"peerDependencies": {
"@material-ui/core": "4.12.4",
"react": ">=16.12.0 < 19.0.0",
"@toptal/picasso-tailwind-merge": "^1.0.1",
"@toptal/picasso-tailwind": ">=2.7"
Expand Down
10 changes: 1 addition & 9 deletions packages/base/Pagination/src/Pagination/Pagination.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
/* eslint-disable react/no-array-index-key */
import type { HTMLAttributes } from 'react'
import React, { forwardRef, useMemo } from 'react'
import type { Theme } from '@material-ui/core/styles'
import { makeStyles } from '@material-ui/core/styles'
import type { BaseProps } from '@toptal/picasso-shared'
import { Button } from '@toptal/picasso-button'
import { Container } from '@toptal/picasso-container'
import { Typography } from '@toptal/picasso-typography'

import { getRange, ELLIPSIS } from './utils'
import styles from './styles'
import { PaginationButton } from '../PaginationButton'

const useStyles = makeStyles<Theme>(styles, {
name: 'PicassoPagination',
})

export interface Props extends BaseProps, HTMLAttributes<HTMLDivElement> {
/** Value of the current highlighted page */
activePage: number
Expand Down Expand Up @@ -44,7 +37,6 @@ export const Pagination = forwardRef<HTMLDivElement, Props>(function Pagination(
variant,
...rest
} = props
const classes = useStyles()

const pages = useMemo(
() => getRange({ activePage, totalPages, siblingCount }),
Expand All @@ -64,7 +56,7 @@ export const Pagination = forwardRef<HTMLDivElement, Props>(function Pagination(
const pageButtons = pages.map((page, index) => {
if (page === ELLIPSIS) {
return (
<Container key={index} className={classes.ellipsis}>
<Container key={index} className='py-0 px-[0.5em] cursor-default'>
<Typography size='xsmall' weight='semibold' color='black'>
{ELLIPSIS}
</Typography>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ exports[`Pagination renders 1`] = `
</span>
</button>
<div
class="PicassoPagination-ellipsis"
class="py-0 px-[0.5em] cursor-default"
>
<p
class="m-0 text-xxs text-black font-semibold"
Expand Down Expand Up @@ -122,7 +122,7 @@ exports[`Pagination renders 1`] = `
</span>
</button>
<div
class="PicassoPagination-ellipsis"
class="py-0 px-[0.5em] cursor-default"
>
<p
class="m-0 text-xxs text-black font-semibold"
Expand Down Expand Up @@ -204,7 +204,7 @@ exports[`Pagination renders disabled 1`] = `
</span>
</button>
<div
class="PicassoPagination-ellipsis"
class="py-0 px-[0.5em] cursor-default"
>
<p
class="m-0 text-xxs text-black font-semibold"
Expand Down Expand Up @@ -293,7 +293,7 @@ exports[`Pagination renders disabled 1`] = `
</span>
</button>
<div
class="PicassoPagination-ellipsis"
class="py-0 px-[0.5em] cursor-default"
>
<p
class="m-0 text-xxs text-black font-semibold"
Expand Down
9 changes: 0 additions & 9 deletions packages/base/Pagination/src/Pagination/styles.ts

This file was deleted.

0 comments on commit 1c2648f

Please sign in to comment.