@@ -8,6 +8,8 @@ import { useQuery } from "@tanstack/react-query";
88import { Board } from "@/types/boards" ;
99import Pagination from "@mui/material/Pagination" ;
1010import Stack from "@mui/material/Stack" ;
11+ import Lottie from "lottie-react" ;
12+ import loadingAnimation from "@/assets/loading.json" ;
1113
1214const getBoards = async ( page : number , limit : number ) => {
1315 const res = await api . get ( "/api/v1/boards/" , {
@@ -19,7 +21,7 @@ const getBoards = async (page: number, limit: number) => {
1921
2022const Boards = ( ) => {
2123 const [ selectedCategory , setSelectedCategory ] = useState ( "전체" ) ;
22- const [ selectedStatus , setSelectedStatus ] = useState < "OPEN" | "CLOSED " | "" > (
24+ const [ selectedStatus , setSelectedStatus ] = useState < "OPEN" | "CLOSE " | "" > (
2325 "" ,
2426 ) ;
2527 const [ page , setPage ] = useState ( 1 ) ;
@@ -62,8 +64,8 @@ const Boards = () => {
6264 setSelectedCategory ( category ) ;
6365 } ;
6466
65- const handleStatusChange = ( status : "OPEN" | "CLOSED " ) => {
66- setSelectedStatus ( ( prevStatus : "OPEN" | "CLOSED " | "" ) =>
67+ const handleStatusChange = ( status : "OPEN" | "CLOSE " ) => {
68+ setSelectedStatus ( ( prevStatus : "OPEN" | "CLOSE " | "" ) =>
6769 prevStatus === status ? "" : status ,
6870 ) ;
6971 } ;
@@ -86,7 +88,7 @@ const Boards = () => {
8688
8789 return (
8890 < main className = "flex min-h-screen flex-col bg-white" >
89- < div className = "flex justify-center lg:justify-start lg:pl-[4rem] xl:pl-[6rem] py-4 md:py-7" >
91+ < div className = "flex justify-center lg:justify-start mt-4 md:mt-0 lg:pl-[4rem] xl:pl-[6rem] py-4 md:py-7" >
9092 < MainTab onCategoryChange = { handleCategoryChange } />
9193 </ div >
9294 < div className = "flex justify-center lg:justify-start gap-[0.75rem] lg:gap-[1.25rem] px-[2rem] lg:px-[6rem] xl:px-[8rem]" >
@@ -101,21 +103,27 @@ const Boards = () => {
101103 < span className = "text-xs" > 모집 중</ span >
102104 </ button >
103105 < button
104- onClick = { ( ) => handleStatusChange ( "CLOSED " ) }
106+ onClick = { ( ) => handleStatusChange ( "CLOSE " ) }
105107 className = { `w-[5rem] lg:w-[6.25rem] h-[2rem] lg:h-[2.25rem] border border-1 rounded-[1.25rem] ${
106- selectedStatus === "CLOSED "
108+ selectedStatus === "CLOSE "
107109 ? "border-darkpink bg-pink"
108110 : "border-gray"
109111 } `}
110112 >
111113 < span className = "text-xs" > 모집 종료</ span >
112114 </ button >
113115 </ div >
114- < div className = "flex justify-center" >
116+ < div className = "flex justify-center items-center py-[1rem] " >
115117 { isLoading ? (
116- < p > Loading...</ p >
118+ < div className = "flex justify-center items-center h-[50vh]" >
119+ < Lottie
120+ animationData = { loadingAnimation }
121+ loop
122+ className = "w-[100px] h-[100px]"
123+ />
124+ </ div >
117125 ) : (
118- < div className = "grid grid-cols-1 xl:grid-cols-2 gap-4 xl:gap-6 py-[1.5rem ]" >
126+ < div className = "grid grid-cols-1 xl:grid-cols-2 gap-4 xl:gap-6 py-[1rem ]" >
119127 { filteredData . map ( ( data : Board ) => (
120128 < PostPreview
121129 key = { data . id }
0 commit comments