import Link from 'next/link'
import { useTranslation } from 'next-i18next'
import { LeftIcon, DoubleLeftIcon, RightIcon, DoubleRightIcon } from 'shared/components/icons.mjs'
const pageButtonClasses = 'btn btn-primary btn-ghost text-base leading-none'
const PageButton = ({ pageNum, label, title, hrefBuilder, onClick, visible = true }) => (
{label}
)
const defaultHrefBuilder = (pageNum) => `#page=${pageNum}`
export const Pagination = ({ current, total, hrefBuilder = defaultHrefBuilder, setPage }) => {
const { t } = useTranslation('common')
const prevButtons = []
const nextButtons = []
// an obnoxious workaround to keep urls on links but have the atom actually update when we change pages
const onClick = (pageNum) => (e) => {
if (typeof setPage === 'function') {
e.preventDefault()
setPage(pageNum)
window.scroll(0, 0)
}
}
const buttonProps = { hrefBuilder, onClick }
for (let i = 1; i < 4; i++) {
const isEnd = i === 3
prevButtons.unshift(