diff --git a/src/app/_components/Pagination/index.module.scss b/src/app/_components/Pagination/index.module.scss new file mode 100644 index 0000000..b115e32 --- /dev/null +++ b/src/app/_components/Pagination/index.module.scss @@ -0,0 +1,4 @@ +.pagination_wrapper { + display: flex; + gap: 10px; +} diff --git a/src/app/_components/Pagination/index.tsx b/src/app/_components/Pagination/index.tsx new file mode 100644 index 0000000..dcdf4f8 --- /dev/null +++ b/src/app/_components/Pagination/index.tsx @@ -0,0 +1,43 @@ +"use client"; + +import Link from "next/link"; +import { usePathname, useSearchParams } from "next/navigation"; +import styles from "./index.module.scss"; + +export const Pagination = () => { + const searchParams = useSearchParams(); + const pathname = usePathname(); + const currentPage = Number(searchParams.get("currentPage")); + const pageSize = Number(searchParams.get("pageSize")); + + return ( + + ); +}; diff --git a/src/app/_components/Posts/index.tsx b/src/app/_components/Posts/index.tsx index 7e8eb30..4828ac4 100644 --- a/src/app/_components/Posts/index.tsx +++ b/src/app/_components/Posts/index.tsx @@ -1,5 +1,15 @@ import React, { PropsWithChildren } from "react"; import styles from "./index.module.scss"; -export const Posts = ({ children }: PropsWithChildren) => ( -
{children}
+import Cards from "@/app/_components/Cards"; +import { Pagination } from "@/app/_components/Pagination"; +import { PostType } from "@/types"; + +interface PostsProps { + posts: PostType[]; +} +export const Posts = ({ posts }: PostsProps) => ( +
+ + +
); diff --git a/src/app/posts/[category]/[subCategory]/page.tsx b/src/app/posts/[category]/[subCategory]/page.tsx index f64be3a..977c5a9 100644 --- a/src/app/posts/[category]/[subCategory]/page.tsx +++ b/src/app/posts/[category]/[subCategory]/page.tsx @@ -1,4 +1,3 @@ -import Cards from "@/app/_components/Cards"; import { Posts } from "@/app/_components/Posts"; import { getPosts } from "@/app/api/dato/getPosts"; import { PostType, SearchParamsType } from "@/types"; @@ -67,9 +66,7 @@ export default async function PostsPageFilteredBySubCategory({ <>

{`${subCategory}`}

- - - + ); } diff --git a/src/app/posts/[category]/page.tsx b/src/app/posts/[category]/page.tsx index 3d1e732..056e580 100644 --- a/src/app/posts/[category]/page.tsx +++ b/src/app/posts/[category]/page.tsx @@ -1,4 +1,3 @@ -import Cards from "@/app/_components/Cards"; import { Posts } from "@/app/_components/Posts"; import { getPosts } from "@/app/api/dato/getPosts"; import { PostType, SearchParamsType } from "@/types"; @@ -58,9 +57,7 @@ export default async function PostsPageFilteredByCategory({ <>

{`${category}`}

- - - + ); } diff --git a/src/app/posts/page.tsx b/src/app/posts/page.tsx index fc28f74..cc3397c 100644 --- a/src/app/posts/page.tsx +++ b/src/app/posts/page.tsx @@ -1,4 +1,3 @@ -import Cards from "@/app/_components/Cards"; import { getPosts } from "@/app/api/dato/getPosts"; import { Metadata } from "next"; import { PostType, SearchParamsType } from "@/types"; @@ -27,9 +26,7 @@ export default async function Home({ searchParams }: SearchParamsType) { return ( <>

{`게시글 전체 보기`}

- - - + ); }