Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New : 술리스트 스켈레톤, 최저높이 추가 #57

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions client/src/components/wiki/AlcoholList.tsx
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;
jobkaeHenry marked this conversation as resolved.
Show resolved Hide resolved