diff --git a/app/blog/[page]/page.tsx b/app/blog/[page]/page.tsx new file mode 100644 index 0000000..1502cd6 --- /dev/null +++ b/app/blog/[page]/page.tsx @@ -0,0 +1,39 @@ +import PostCard from 'components/post-card'; +import PostCardLoading from 'components/rua/loading/post-card-loading'; +import { PostPerPage, postLists } from 'lib/posts'; +import { Fragment, Suspense } from 'react'; +import Pagination from 'components/rua/rua-pagination'; +import { notFound } from 'next/navigation'; + +export default async function Page({ params }: { params: { page: string } }) { + const page = Number(params.page); + if (!page) notFound(); + + const allPosts = await postLists(); + const posts = allPosts.slice((page - 1) * PostPerPage, PostPerPage * page); + const prev = page - 1; + const next = page + 1; + const total = Math.ceil(allPosts.length / PostPerPage); + + return ( + <> + {posts.map((post) => ( + + }> + + + + ))} + + + + ); +} diff --git a/app/blog/page.tsx b/app/blog/page.tsx index 559ac03..ff0bca5 100644 --- a/app/blog/page.tsx +++ b/app/blog/page.tsx @@ -5,9 +5,10 @@ import { Fragment, Suspense } from 'react'; import Pagination from 'components/rua/rua-pagination'; export default async function Page() { - const posts = (await postLists()).slice(0, PostPerPage); + const allPosts = await postLists(); + const posts = allPosts.slice(0, PostPerPage); const next = 2; - const total = Math.ceil(posts.length / PostPerPage); + const total = Math.ceil(allPosts.length / PostPerPage); return ( <> diff --git a/app/fonts.ts b/app/fonts.ts index f3cd268..9ccbae0 100644 --- a/app/fonts.ts +++ b/app/fonts.ts @@ -22,7 +22,6 @@ export const aref_ruqaa = Aref_Ruqaa({ export const barlow = Barlow({ weight: ['100', '200', '300', '400', '500', '600', '700', '800', '900'], - style: 'italic', variable: '--font-barlow', display: 'swap', subsets: ['latin'],