11import Image from 'next/image' ;
2- import Short from '@/shared/assets/icons/short_36.svg' ;
32import Label from '@/domains/shared/components/label/Label' ;
43import AbvGraph from '@/domains/shared/components/abv-graph/AbvGraph' ;
54import { labelTitle } from '../utills/labelTitle' ;
5+ import useGlass from './hook/useGlass' ;
66
77interface Props {
88 name : string ;
@@ -15,6 +15,19 @@ interface Props {
1515
1616function DetailItem ( { name, nameKo, story, src, abv, glassType } : Props ) {
1717 const alcoholTitle = labelTitle ( abv ) ;
18+ const abvNum = abv
19+ . replace ( / \( ( [ ^ ) ] * ) \) / g, '$1' )
20+ . split ( ' ' )
21+ . reverse ( )
22+ . slice ( 0 , 1 )
23+ . toString ( ) ;
24+ const maxAbv = abvNum
25+ . replace ( / [ ~ % ] / g, ' ' )
26+ . split ( ' ' )
27+ . filter ( ( str ) => str . trim ( ) !== '' )
28+ . map ( Number ) ;
29+
30+ const glassIcon = useGlass ( glassType ) ;
1831
1932 return (
2033 < div className = "flex flex-col items-center" >
@@ -37,8 +50,15 @@ function DetailItem({ name, nameKo, story, src, abv, glassType }: Props) {
3750 < span className = "absolute w-3 h-3 rounded-full -bottom-38 z-2 left-1/2 -translate-x-1/2 bg-secondary md:bg-transparent" > </ span >
3851 </ div >
3952
40- < div className = "rounded-2xl overflow-hidden w-75 h-93.75 mt-32 md:mt-4 lg:mt-7 [filter:drop-shadow(0_0_20px_rgba(255,255,255,0.3))]" >
41- < Image src = { src } alt = { `${ nameKo } 사진` } fill className = "object-cover" />
53+ < div className = "rounded-2xl overflow-hidden w-75 h-93.75 mt-32 md:mt-4 lg:mt-7 [filter:drop-shadow(0_0_20px_rgba(255,255,255,0.3))] relative" >
54+ < Image
55+ src = { src }
56+ alt = { `${ nameKo } 사진` }
57+ fill
58+ className = "object-cover"
59+ sizes = "300px"
60+ priority
61+ />
4262 </ div >
4363
4464 < dl className = "flex flex-col mt-5 gap-3 w-75" >
@@ -48,18 +68,22 @@ function DetailItem({ name, nameKo, story, src, abv, glassType }: Props) {
4868 < span > |</ span >
4969 </ dt >
5070 < dd className = "flex gap-3 items-center" >
51- < p className = "text-xs" > { abv } </ p >
52- < AbvGraph />
71+ < p className = "text-xs" > { abvNum } </ p >
72+ < AbvGraph abv = { Math . max ( ... maxAbv ) } max = { 40 } />
5373 </ dd >
5474 </ div >
5575 < div className = "flex items-center gap-3" >
5676 < dt className = "flex gap-2 items-center" >
5777 < p > 글래스 타입</ p >
5878 < span > |</ span >
5979 </ dt >
60- < dd className = "flex items-center gap-2" >
61- < Short />
62- < p > { glassType } 드링크</ p >
80+ < dd className = "flex items-center " >
81+ { glassIcon }
82+ < p >
83+ { glassType == '숏' || glassType == '롱'
84+ ? `${ glassType } 드링크`
85+ : `${ glassType } 칵테일` }
86+ </ p >
6387 </ dd >
6488 </ div >
6589 </ dl >
0 commit comments