diff --git a/src/components/Pagenation/index.astro b/src/components/Pagenation/index.astro deleted file mode 100644 index 00cdcd8..0000000 --- a/src/components/Pagenation/index.astro +++ /dev/null @@ -1,96 +0,0 @@ ---- -import { pipe } from 'remeda'; - -interface Props { - page: number; - pageNum: number; - getPagePath: (n: number) => string; -} -const { page, pageNum, getPagePath } = Astro.props; - -const N = 2; - -const visiblePageNums = pipe(null, () => { - const min = page - N < 1 ? 1 : page - N; - const max = page + N > pageNum ? pageNum : page + N; - return Array.from({ length: max - min + 1 }, (_, i) => min + i); -}); ---- - -
- {visiblePageNums.at(0)! > 1 && 1} - {visiblePageNums.at(0)! > 2 && } - - { - visiblePageNums.map((n) => ( - - {n} - - )) - } - - {visiblePageNums.at(-1)! < pageNum - 1 && } - {visiblePageNums.at(-1)! < pageNum && {pageNum}} -
- -