44
55import { useEffect , useState } from 'react' ;
66import { useTranslation } from 'react-i18next' ;
7- import { css } from '_panda/css' ;
8- import { CardBack as CardBackUi } from '@gitanimals/ui-panda' ;
7+ import { CardBack as CardBackUi } from '@gitanimals/ui-tailwind' ;
98import { motion } from 'framer-motion' ;
9+ import { cn } from '@gitanimals/ui-tailwind/utils' ;
1010
1111import { AnimalCard } from '@/components/AnimalCard' ;
1212import { Portal } from '@/components/Portal' ;
@@ -108,11 +108,14 @@ export function CardDrawingGame({ characters, onSelectCard, onClose }: CardDrawi
108108 startDrawing ( ) ;
109109 } , [ ] ) ;
110110
111+ const cardContainerClass =
112+ 'relative z-0 flex h-full w-full items-center justify-center' ;
113+
111114 return (
112- < div className = { containerStyle } >
113- < div className = { gameAreaStyle } >
115+ < div className = "mx-auto w-full" >
116+ < div className = "relative flex h-[360px] items-center justify-center" >
114117 { gameState === 'drawing' && (
115- < div className = { cardContainerStyle } >
118+ < div className = { cardContainerClass } >
116119 { selectedCards . map ( ( cardId , index ) => {
117120 const { x, y, rotate } = getFanPosition ( index , selectedCards . length ) ;
118121
@@ -133,7 +136,7 @@ export function CardDrawingGame({ characters, onSelectCard, onClose }: CardDrawi
133136 ) }
134137
135138 { gameState === 'revealing' && selectedCardIndex !== null && (
136- < div className = { cardContainerStyle } >
139+ < div className = { cardContainerClass } >
137140 { selectedCards . map ( ( cardId , index ) => {
138141 const isSelected = index === selectedCardIndex ;
139142 const { x, y, rotate } = getFanPosition ( index , selectedCards . length ) ;
@@ -156,19 +159,28 @@ export function CardDrawingGame({ characters, onSelectCard, onClose }: CardDrawi
156159 ) }
157160
158161 { gameState === 'selected' && selectedCardIndex !== null && (
159- < div className = { cardContainerStyle } >
162+ < div className = { cardContainerClass } >
160163 { selectedCards . map ( ( cardId , index ) => {
161164 const isSelected = index === selectedCardIndex ;
162165 const { x, y, rotate } = getFanPosition ( index , selectedCards . length ) ;
163166
164167 if ( isSelected && cardData ) {
165168 return (
166169 < Portal key = { `selected-card-${ cardId } ` } >
167- < div className = { overlayStyle } onClick = { closeGame } >
170+ < div
171+ className = "fixed inset-0 z-[3001] flex flex-col items-center justify-center gap-[100px] bg-black-50 backdrop-blur-[10px]"
172+ onClick = { closeGame }
173+ >
168174 < SelectedCardMotion key = { `selected-card-${ cardId } ` } x = { x } y = { y } rotate = { rotate } index = { index } >
169175 < DetailedCard cardData = { cardData } />
170176 </ SelectedCardMotion >
171- < p className = { noticeMessageStyle } > { t ( 'click-to-close' ) } </ p >
177+ < p
178+ className = { cn (
179+ 'text-center text-white font-product text-glyph-16 md:text-glyph-22' ,
180+ ) }
181+ >
182+ { t ( 'click-to-close' ) }
183+ </ p >
172184 </ div >
173185 </ Portal >
174186 ) ;
@@ -189,7 +201,7 @@ export function CardDrawingGame({ characters, onSelectCard, onClose }: CardDrawi
189201
190202function CardBack ( ) {
191203 return (
192- < div className = { cardBackStyle } style = { { backfaceVisibility : 'hidden' } } >
204+ < div className = "h-[272px] w-[220px] overflow-hidden" style = { { backfaceVisibility : 'hidden' } } >
193205 < CardBackUi tier = "S_PLUS" />
194206 </ div >
195207 ) ;
@@ -204,7 +216,10 @@ function DetailedCard({ cardData }: { cardData: { type: string; dropRate: string
204216 } ;
205217
206218 return (
207- < div className = { detailedCardStyle } style = { { backfaceVisibility : 'hidden' } } >
219+ < div
220+ className = "relative aspect-[220/272] h-auto overflow-hidden [transform-style:preserve-3d]"
221+ style = { { backfaceVisibility : 'hidden' } }
222+ >
208223 < AnimalCard type = { getPersona . type } dropRate = { getPersona . dropRate } />
209224 </ div >
210225 ) ;
@@ -225,7 +240,7 @@ function RevealingCardMotion({
225240} ) {
226241 return (
227242 < motion . div
228- className = { revealingCardMotionStyle }
243+ className = "absolute z-10 cursor-pointer [transform-style:preserve-3d]"
229244 initial = { { x, y, rotateZ : rotate } }
230245 animate = { {
231246 x : [ x , x + 5 , x - 5 , x + 5 , x - 5 , x ] ,
@@ -242,72 +257,3 @@ function RevealingCardMotion({
242257 </ motion . div >
243258 ) ;
244259}
245-
246- const containerStyle = css ( {
247- width : '100%' ,
248- mx : 'auto' ,
249- } ) ;
250-
251- const gameAreaStyle = css ( {
252- position : 'relative' ,
253- height : '360px' ,
254- display : 'flex' ,
255- alignItems : 'center' ,
256- justifyContent : 'center' ,
257- } ) ;
258-
259- const cardContainerStyle = css ( {
260- position : 'relative' ,
261- zIndex : 0 ,
262- width : '100%' ,
263- height : '100%' ,
264- display : 'flex' ,
265- alignItems : 'center' ,
266- justifyContent : 'center' ,
267- } ) ;
268-
269- const overlayStyle = css ( {
270- position : 'fixed' ,
271- top : 0 ,
272- left : 0 ,
273- width : '100%' ,
274- height : '100%' ,
275- bg : 'black.black_50' ,
276- display : 'flex' ,
277- alignItems : 'center' ,
278- justifyContent : 'center' ,
279- backdropFilter : 'blur(10px)' ,
280- flexDirection : 'column' ,
281- gap : '100px' ,
282- zIndex : 3001 ,
283- } ) ;
284-
285- const revealingCardMotionStyle = css ( {
286- position : 'absolute' ,
287- zIndex : 10 ,
288- transformStyle : 'preserve-3d' ,
289- cursor : 'pointer' ,
290- } ) ;
291-
292- const cardBackStyle = css ( {
293- width : '220px' ,
294- height : '272px' ,
295- overflow : 'hidden' ,
296- } ) ;
297-
298- const detailedCardStyle = css ( {
299- height : 'auto' ,
300- overflow : 'hidden' ,
301- position : 'relative' ,
302- transformStyle : 'preserve-3d' ,
303- aspectRatio : '220/272' ,
304- } ) ;
305-
306- const noticeMessageStyle = css ( {
307- textStyle : 'glyph22.regular' ,
308- color : 'white' ,
309- textAlign : 'center' ,
310- _mobile : {
311- textStyle : 'glyph16.regular' ,
312- } ,
313- } ) ;
0 commit comments