From a62f420f4de93c25f76624d27315f60ba7101b14 Mon Sep 17 00:00:00 2001 From: DefectingCat Date: Tue, 23 Aug 2022 15:04:51 +0800 Subject: [PATCH] Add blog post pagination --- components/RUA/RUAPagination.tsx | 6 ++- layouts/BlogList.tsx | 24 ++++++++++ lib/posts.ts | 19 ++++++++ pages/blog.tsx | 48 ------------------- pages/blog/[page].tsx | 79 ++++++++++++++++++++++++++++++++ pages/blog/index.tsx | 67 +++++++++++++++++++++++++++ pages/gists/[p].tsx | 20 +++++++- pages/gists/index.tsx | 13 ++++-- 8 files changed, 220 insertions(+), 56 deletions(-) create mode 100644 layouts/BlogList.tsx delete mode 100644 pages/blog.tsx create mode 100644 pages/blog/[page].tsx create mode 100644 pages/blog/index.tsx diff --git a/components/RUA/RUAPagination.tsx b/components/RUA/RUAPagination.tsx index 0fd7e56..588a813 100644 --- a/components/RUA/RUAPagination.tsx +++ b/components/RUA/RUAPagination.tsx @@ -1,5 +1,6 @@ import dynamic from 'next/dynamic'; import Link from 'next/link'; +import { DetailedHTMLProps, HTMLAttributes } from 'react'; const Button = dynamic(() => import('components/RUA/Button')); @@ -10,7 +11,7 @@ type Props = { nextLink: string; current?: number; total?: number; -}; +} & DetailedHTMLProps, HTMLElement>; const RUAPagination = ({ hasPrev, @@ -19,10 +20,11 @@ const RUAPagination = ({ nextLink, current, total, + ...rest }: Props) => { return ( <> -