-
Notifications
You must be signed in to change notification settings - Fork 1
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
34b390d
commit f374280
Showing
1 changed file
with
19 additions
and
4 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 |
---|---|---|
@@ -1,25 +1,40 @@ | ||
"use client"; | ||
import AlcoholNameTag from "@/components/wiki/AlcoholNameTag"; | ||
import useGetAlcoholListQuery from "@/queries/alcohol/useGetAlcoholListQuery"; | ||
import { Pagination, Stack } from "@mui/material"; | ||
import { Box, Pagination, Skeleton, Stack } from "@mui/material"; | ||
import { memo } from "react"; | ||
|
||
const AlcoholList = () => { | ||
const { data: alcohols } = useGetAlcoholListQuery(); | ||
return ( | ||
<Stack alignItems="center" gap={2}> | ||
<Stack gap={1} alignItems="center" width={'100%'}> | ||
{alcohols && | ||
<Stack gap={1} alignItems="center" width={"100%"} height={"232px"}> | ||
{alcohols ? ( | ||
alcohols.list.map((alcohol) => ( | ||
<AlcoholNameTag | ||
key={alcohol.alcoholNo} | ||
alcoholName={alcohol.alcoholName} | ||
alcoholType={alcohol.alcoholType} | ||
/> | ||
))} | ||
)) | ||
) : ( | ||
<AlcoholListSkeleton /> | ||
)} | ||
</Stack> | ||
<Pagination count={alcohols?.totalCount} /> | ||
</Stack> | ||
); | ||
}; | ||
|
||
const AlcoholListSkeleton = memo(() => { | ||
return Array.from(new Array(5)).map(() => ( | ||
<Skeleton | ||
variant="rectangular" | ||
width={"100%"} | ||
height={40} | ||
sx={{ borderRadius: 2 }} | ||
/> | ||
)); | ||
}); | ||
|
||
export default AlcoholList; |