File tree Expand file tree Collapse file tree
examples/ui-playground/src/app/playground/shadcn
packages/ui/src/components/primitives Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -194,14 +194,13 @@ function WithEllipsisPagination() {
194194 < div className = "space-y-4" >
195195 < Pagination >
196196 < PaginationContent >
197- < PaginationItem >
197+ < PaginationItem disabled = { currentPage === 1 } >
198198 < PaginationPrevious
199199 href = "#"
200200 onClick = { ( e ) => {
201201 e . preventDefault ( )
202202 setCurrentPage ( Math . max ( 1 , currentPage - 1 ) )
203203 } }
204- className = { currentPage === 1 ? 'pointer-events-none opacity-50' : '' }
205204 />
206205 </ PaginationItem >
207206
@@ -261,14 +260,13 @@ function WithEllipsisPagination() {
261260 </ >
262261 ) }
263262
264- < PaginationItem >
263+ < PaginationItem disabled = { currentPage === totalPages } >
265264 < PaginationNext
266265 href = "#"
267266 onClick = { ( e ) => {
268267 e . preventDefault ( )
269268 setCurrentPage ( Math . min ( totalPages , currentPage + 1 ) )
270269 } }
271- className = { currentPage === totalPages ? 'pointer-events-none opacity-50' : '' }
272270 />
273271 </ PaginationItem >
274272 </ PaginationContent >
Original file line number Diff line number Diff line change @@ -4,8 +4,9 @@ import * as React from 'react'
44import { ArrowLeftIcon , ArrowRightIcon , DotsThreeIcon } from '@phosphor-icons/react'
55import { Slot } from '@radix-ui/react-slot'
66import { useControllableState } from '@radix-ui/react-use-controllable-state'
7+ import type { VariantProps } from 'class-variance-authority'
78
8- import { type Button , buttonVariants } from './button'
9+ import { buttonVariants } from './button'
910import { ButtonGroup , buttonGroupVariants } from './button-group'
1011import {
1112 Select ,
@@ -41,13 +42,20 @@ function PaginationContent({ className, ...props }: React.ComponentProps<typeof
4142 )
4243}
4344
45+ interface PaginationItemProps
46+ extends React . ComponentProps < typeof Slot > ,
47+ VariantProps < typeof buttonVariants > {
48+ isActive ?: boolean
49+ disabled ?: boolean
50+ }
51+
4452function PaginationItem ( {
4553 className,
4654 variant = 'outline' ,
4755 size = 'icon' ,
4856 isActive,
4957 ...props
50- } : { isActive ?: boolean } & React . ComponentProps < typeof Button > ) {
58+ } : PaginationItemProps ) {
5159 return (
5260 < Slot
5361 { ...props }
You can’t perform that action at this time.
0 commit comments