-
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
5678c43
commit 5692794
Showing
10 changed files
with
198 additions
and
24 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
27 changes: 27 additions & 0 deletions
27
client/src/app/wiki/[alcoholNo]/(components)/AlcoholDetailLabel.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,27 @@ | ||
import { Stack, Typography } from "@mui/material"; | ||
import React from "react"; | ||
|
||
interface AlcoholDetailLabelProps { | ||
title: string; | ||
type: string; | ||
} | ||
|
||
const AlcoholDetailLabel = ({ title, type }: AlcoholDetailLabelProps) => { | ||
return ( | ||
<Stack | ||
bgcolor={"rgba(123, 31, 162, 0.4)"} | ||
gap={1} | ||
sx={{ | ||
borderRadius: 3, | ||
p: 2, | ||
backdropFilter: "blur(10px)", | ||
color: "background.paper", | ||
}} | ||
> | ||
<Typography variant='label'>{type}</Typography> | ||
<Typography variant='subtitle2' fontWeight="bold">{title}</Typography> | ||
</Stack> | ||
); | ||
}; | ||
|
||
export default AlcoholDetailLabel; |
88 changes: 88 additions & 0 deletions
88
client/src/app/wiki/[alcoholNo]/(components)/AlcoholDetailPage.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,88 @@ | ||
"use client"; | ||
import useGetAlcoholDetailQuery from "@/queries/alcohol/useGetAlcoholDetailQuery"; | ||
import { AlcoholDetailInterface } from "@/types/alcohol/AlcoholInterface"; | ||
import { Stack, Typography, Divider } from "@mui/material"; | ||
import { ReactNode } from "react"; | ||
import AlcoholDetailThumbnail from "./AlcoholDetailThumbnail"; | ||
|
||
type Props = { | ||
alcoholNo: string; | ||
initialData: AlcoholDetailInterface; | ||
children?: ReactNode; | ||
}; | ||
|
||
const AlcoholDetailPage = ({ alcoholNo, initialData, children }: Props) => { | ||
const { data: alcoholInfo } = useGetAlcoholDetailQuery( | ||
alcoholNo, | ||
initialData | ||
); | ||
|
||
return ( | ||
<Stack gap={2}> | ||
<AlcoholDetailThumbnail | ||
title={alcoholInfo.alcoholName} | ||
type={alcoholInfo.alcoholType} | ||
src={alcoholInfo.alcoholAttachUrls[0]?.attachUrl} | ||
/> | ||
{children} | ||
|
||
<Stack gap={2}> | ||
<Typography | ||
variant={"subtitle1"} | ||
color="primary.main" | ||
fontWeight="bold" | ||
> | ||
Tasting Notes | ||
</Typography> | ||
<Stack gap={2}> | ||
<Stack direction="row"> | ||
<Typography width="78px">Aroma</Typography> | ||
<Typography fontWeight="bold"> | ||
{alcoholInfo.taste.Aroma.join(", ")} | ||
</Typography> | ||
</Stack> | ||
<Stack direction="row"> | ||
<Typography width="78px">Taste</Typography> | ||
<Typography fontWeight="bold"> | ||
{alcoholInfo.taste.Taste.join(", ")} | ||
</Typography> | ||
</Stack> | ||
<Stack direction="row"> | ||
<Typography width="78px">Finish</Typography> | ||
<Typography fontWeight="bold"> | ||
{alcoholInfo.taste.Finish.join(", ")} | ||
</Typography> | ||
</Stack> | ||
</Stack> | ||
</Stack> | ||
|
||
<Divider sx={{ borderColor: "#F6EAFB" }} /> | ||
|
||
<Stack gap={2}> | ||
<Typography | ||
variant={"subtitle1"} | ||
color="primary.main" | ||
fontWeight="bold" | ||
> | ||
Information | ||
</Typography> | ||
<Stack gap={2}> | ||
<Stack direction="row"> | ||
<Typography width="78px">종류</Typography> | ||
<Typography fontWeight="bold">{alcoholInfo.alcoholType}</Typography> | ||
</Stack> | ||
<Stack direction="row"> | ||
<Typography width="78px">도수</Typography> | ||
<Typography fontWeight="bold">{alcoholInfo.degree}%</Typography> | ||
</Stack> | ||
<Stack direction="row"> | ||
<Typography width="78px">용량</Typography> | ||
<Typography fontWeight="bold">{alcoholInfo.volume}ml</Typography> | ||
</Stack> | ||
</Stack> | ||
</Stack> | ||
</Stack> | ||
); | ||
}; | ||
|
||
export default AlcoholDetailPage; |
34 changes: 34 additions & 0 deletions
34
client/src/app/wiki/[alcoholNo]/(components)/AlcoholDetailThumbnail.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,34 @@ | ||
//@ts-ignore | ||
import LogoLarge from "@/assets/icons/LogoLarge.svg?url"; | ||
import { Box } from "@mui/material"; | ||
import AlcoholDetailLabel from "./AlcoholDetailLabel"; | ||
|
||
interface AlcoholDetailThumbnailProps { | ||
title: string; | ||
type: string; | ||
src?: string; | ||
} | ||
|
||
const AlcoholDetailThumbnail = ({ | ||
title, | ||
type, | ||
src, | ||
}: AlcoholDetailThumbnailProps) => { | ||
return ( | ||
<Box | ||
height={410} | ||
bgcolor={src ? "background.paper" : "gray.primary"} | ||
p={2} | ||
sx={{ | ||
backgroundImage: `url(${src ?? LogoLarge.src})`, | ||
backgroundRepeat: "no-repeat", | ||
backgroundSize: "contain", | ||
backgroundPosition: "center", | ||
}} | ||
> | ||
<AlcoholDetailLabel title={title} type={type} /> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default AlcoholDetailThumbnail; |
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
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,28 @@ | ||
import { GET_ALCOHOL_DETAIL } from "@/const/serverPath"; | ||
import axios from "@/libs/axios"; | ||
import { AlcoholDetailInterface } from "@/types/alcohol/AlcoholInterface"; | ||
import { useSuspenseQuery } from "@tanstack/react-query"; | ||
|
||
const useGetAlcoholDetailQuery = ( | ||
id: string, | ||
initialData?: AlcoholDetailInterface | ||
) => | ||
useSuspenseQuery({ | ||
queryKey: AlcoholDetailQueryKey.byId(id), | ||
queryFn: () => getAlcoholDetailById(id), | ||
initialData, | ||
}); | ||
|
||
export const AlcoholDetailQueryKey = { | ||
all: ["alcoholDetail"] as const, | ||
byId: (id: string) => ["alcoholDetail", id] as const, | ||
}; | ||
|
||
export const getAlcoholDetailById = async (id: string) => { | ||
const { data } = await axios.get<AlcoholDetailInterface>( | ||
GET_ALCOHOL_DETAIL(id) | ||
); | ||
return data; | ||
}; | ||
|
||
export default useGetAlcoholDetailQuery; |
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