-
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.
* Minor : 컴포넌트 디렉토리 변경 * Minor : 컴포넌트 디렉토리 변경 * Minor : 스타일 변경 * Minor : 인터페이스 명 변경 * New : Next Image remote patterns 추가 * New : 이미지 추가 * New : 술상세페이지내 포스트리스트 추가 * Refactor : SearchParam으로 제공된 AlcoholNo로 검색이 가능하도록 리팩토링
- Loading branch information
1 parent
11f70db
commit 8f4f8bf
Showing
17 changed files
with
306 additions
and
46 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
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
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
File renamed without changes.
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
76 changes: 76 additions & 0 deletions
76
client/src/components/wiki/detail/AlcoholDetailPostCardList.tsx
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,76 @@ | ||
"use client"; | ||
|
||
import AlcoholeDetailPostCard from "./AlcoholeDetailPostCard"; | ||
import ArrowDownwardIcon from "@mui/icons-material/ArrowDownward"; | ||
import { Stack, Box, Button, CircularProgress, Typography } from "@mui/material"; | ||
|
||
import AlcoholDetailPostCardListHeader from "./AlcoholDetailPostCardListHeader"; | ||
import useGetPostListInfiniteQuery, { | ||
AugmentedGetPostListResponse, | ||
} from "@/queries/post/useGetPostListInfiniteQuery"; | ||
import { SEARCH_BY_ALCOHOLNO } from "@/const/clientPath"; | ||
|
||
type Props = { | ||
initialData?: AugmentedGetPostListResponse; | ||
alcoholNo: number; | ||
}; | ||
|
||
const AlcoholDetailPostCardList = ({ initialData, alcoholNo }: Props) => { | ||
const { data, hasNextPage, isFetching, fetchNextPage } = | ||
useGetPostListInfiniteQuery({ | ||
initialData, | ||
searchAlcoholNos: alcoholNo, | ||
size: 3, | ||
}); | ||
const hasPost = (data?.pages?.[0]?.content?.length ?? 0) > 0; | ||
|
||
return ( | ||
<div> | ||
<AlcoholDetailPostCardListHeader | ||
totalContents={data?.pages?.[0]?.totalElements ?? 0} | ||
href={SEARCH_BY_ALCOHOLNO(alcoholNo)} | ||
/> | ||
<Stack gap={2} py={2} mt={6}> | ||
{hasPost ? ( | ||
<> | ||
{data?.pages.map(({ content }) => | ||
content.map((data) => ( | ||
<AlcoholeDetailPostCard {...data} key={data.postNo} /> | ||
)) | ||
)} | ||
{hasNextPage && ( | ||
<Button | ||
sx={ButtonStyle} | ||
onClick={() => fetchNextPage()} | ||
disabled={isFetching} | ||
> | ||
캐스크 더보기 | ||
<ArrowDownwardIcon sx={{ color: "primary.main" }} /> | ||
</Button> | ||
)} | ||
{isFetching && <CircularProgress sx={{ mx: "auto" }} />} | ||
</> | ||
) : ( | ||
<Typography textAlign='center'>작성된 캐스크가 없습니다</Typography> | ||
)} | ||
</Stack> | ||
<Box | ||
bgcolor={"gray.primary"} | ||
position={"absolute"} | ||
height={16} | ||
left={0} | ||
right={0} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
const ButtonStyle = { | ||
backgroundColor: "#F6EAFB", | ||
color: "primary.main", | ||
":hover": { | ||
backgroundColor: "#F6EAFB", | ||
}, | ||
}; | ||
|
||
export default AlcoholDetailPostCardList; |
Oops, something went wrong.