All Downloads are FREE. Search and download functionalities are using the official Maven repository.

components.snippets.Pagination.ExtraPage.tsx Maven / Gradle / Ivy

The newest version!
import React from 'react'
import classNames from 'classnames'

import { Select } from './Select'
import { PAGE_LINK_CLASS, ExtraPage as ExtraPageProps } from './constants'

function Ellipsis({ visible }: { visible: boolean }) {
    if (!visible) {
        return null
    }

    return ...
}

export function ExtraPage({ visible, page, onSelect, ellipsis, showLast, hasNext, disabled = false, canSelect = true }: ExtraPageProps) {
    if (!visible) {
        return null
    }

    const setPage = () => {
        if (canSelect && page) {
            onSelect(page)
        }
    }

    const needToSelect = canSelect && typeof page === 'number'
    const leftCondition = showLast ? true : hasNext

    return (