components.snippets.Pagination.Pages.tsx Maven / Gradle / Ivy
The newest version!
import React from 'react'
import { Select } from './Select'
import { ExtraPage } from './ExtraPage'
import { PAGE_LINK_CLASS, Pages as PagesProps } from './constants'
export function Pages({
pages,
activePage,
onSelect,
extraFirstVisible,
extraLastVisible,
lastPage,
showLast,
hasNext,
loading,
visible,
}: PagesProps) {
if (!pages.length || !visible) {
return null
}
return (
{pages.map((page) => {
const active = activePage === page
const setPage = () => {
if (!active && !loading) {
onSelect(page)
}
}
return (
)
})}
)
}