-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5583a7d
commit 84a887b
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
"use client"; | ||
|
||
import { useCallback, useEffect, useState } from "react"; | ||
|
||
import { Class } from "@/entities/class/model/class"; | ||
import { ClassList } from "@/entities/class/ui"; | ||
import SkeletonCard from "@/entities/class/ui/Class/SkeletonCard/SkeletonCard"; | ||
import useEntireClass from "@/entities/class/api/useEntireClass"; | ||
|
||
const EntirePage = () => { | ||
const [classListData, setClassListData] = useState<Class[]>(); | ||
|
||
// TODO: 전체 클래스 가져오는 API로 수정 필요 | ||
const { data, isLoading, isSuccess } = useEntireClass(); | ||
|
||
const handleEntireClassDataList = useCallback(() => { | ||
if (data) { | ||
const entireClassData = data.data.data; | ||
// FIXME: 수정 | ||
setClassListData(entireClassData); | ||
} | ||
}, [data]); | ||
|
||
useEffect(() => { | ||
if (isSuccess) { | ||
handleEntireClassDataList(); | ||
} | ||
}, [handleEntireClassDataList, isSuccess]); | ||
|
||
return ( | ||
<div className="flex flex-col w-full h-screen justify-start items-center p-4 min-h-[336px] pt-20 bg-[#E9E8EC]"> | ||
<div className="flex flex-row w-full h-12 items-start justify-center"> | ||
<div className="flex flew-row gap-1"> | ||
<div className="text-gray-900 text-[32px] font-bold">전체 클래스</div> | ||
<div className="text-gray-900 text-[32px]">한번에 보기</div> | ||
</div> | ||
</div> | ||
<div className="flex flex-col pt-14 pb-[209px]"> | ||
<div className="flex px-[120px]"> | ||
{/* FIXME: 수정 필요 */} | ||
{isLoading ? ( | ||
<div className="flex flex-row space-x-6"> | ||
<SkeletonCard type="col" /> | ||
<SkeletonCard type="col" /> | ||
<SkeletonCard type="col" /> | ||
</div> | ||
) : classListData && isSuccess ? ( | ||
<ClassList classListData={classListData} type="col" /> | ||
) : ( | ||
<div>클래스가 존재하지 않습니다</div> | ||
)} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default EntirePage; |