Skip to content

Commit 748bb05

Browse files
authored
refactor(webview): PandaCSS 제거 및 @gitanimals/ui-tailwind 전환 (#382)
1 parent 2ca6221 commit 748bb05

75 files changed

Lines changed: 676 additions & 2536 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/webview/.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,3 @@ dist-ssr
2222
*.njsproj
2323
*.sln
2424
*.sw?
25-
26-
## Panda
27-
styled-system
28-
styled-system-studio

apps/webview/package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
"version": "0.1.0",
44
"private": false,
55
"scripts": {
6-
"prepare": "panda codegen",
76
"dev": "vite --port 3000",
8-
"prebuild": "panda codegen",
97
"build": "tsc -b && vite build",
108
"lint": "eslint .",
119
"lint:fix": "eslint 'src/**/*.{js,jsx,ts,tsx}' --fix",
@@ -17,8 +15,7 @@
1715
"@gitanimals/dayjs": "workspace:*",
1816
"@gitanimals/exception": "workspace:*",
1917
"@gitanimals/react-query": "workspace:*",
20-
"@gitanimals/ui-panda": "workspace:*",
21-
"@gitanimals/ui-token": "workspace:*",
18+
"@gitanimals/ui-tailwind": "workspace:*",
2219
"@gitanimals/util-common": "workspace:*",
2320
"@suspensive/react": "^2.17.1",
2421
"@tanstack/react-query": "*",
@@ -38,13 +35,14 @@
3835
"devDependencies": {
3936
"@gitanimals/eslint-config": "workspace:*",
4037
"@gitanimals/typescript-config": "workspace:*",
41-
"@pandacss/dev": "^0.41.0",
42-
"@shadow-panda/preset": "^0.7.1",
4338
"@types/node": "*",
4439
"@types/react": "*",
4540
"@types/react-dom": "*",
4641
"@vitejs/plugin-react": "^4.3.0",
42+
"autoprefixer": "^10.4.20",
4743
"eslint": "^8",
44+
"postcss": "^8.4.49",
45+
"tailwindcss": "^3.4.17",
4846
"typescript": "*",
4947
"vite": "^7.1.2"
5048
}

apps/webview/panda.config.ts

Lines changed: 0 additions & 40 deletions
This file was deleted.

apps/webview/postcss.config.cjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module.exports = {
22
plugins: {
3-
'@pandacss/dev/postcss': {},
3+
tailwindcss: {},
4+
autoprefixer: {},
45
},
5-
}
6+
};

apps/webview/src/App.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
55

66
import { NuqsAdapter } from 'nuqs/adapters/react';
7-
import { css } from '_panda/css';
87
import AuthWrapper from './components/auth/AuthWrapper';
98
import { RouterProvider } from 'react-router-dom';
109
import { router } from './router';

apps/webview/src/components/AnimalCard/AnimalCard.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { ComponentProps } from 'react';
2-
import { CardBack, GameCard } from '@gitanimals/ui-panda';
3-
import type { CardTierType } from '@gitanimals/ui-panda/src/components/Card/constants';
2+
import { CardBack, GameCard, type CardTierType } from '@gitanimals/ui-tailwind';
43

54
import { getAnimalTierInfo } from '@/utils/animals';
65
import { getPersonaImage } from '@/utils/image';
@@ -24,8 +23,14 @@ function AnimalCard(props: AnimalCardProps) {
2423
);
2524
}
2625

27-
export function AnimalCardBack({ tier = 'S_PLUS' }: ComponentProps<typeof CardBack> & { tier?: CardTierType }) {
28-
return <CardBack tier={tier} />;
26+
type CardBackTier = ComponentProps<typeof CardBack>['tier'];
27+
28+
function toCardBackTier(tier: CardTierType): CardBackTier {
29+
return tier === 'EVOLUTION' ? 'S_PLUS' : tier;
30+
}
31+
32+
export function AnimalCardBack({ tier = 'S_PLUS' }: { tier?: CardTierType }) {
33+
return <CardBack tier={toCardBackTier(tier)} />;
2934
}
3035

3136
export default AnimalCard;

apps/webview/src/components/CardGame/FanDrawingGame/CardMotion.tsx

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { PropsWithChildren } from 'react';
2-
import { css, cx } from '_panda/css';
32
import { motion } from 'framer-motion';
3+
import { cn } from '@gitanimals/ui-tailwind/utils';
44

55
interface CardMotionProps {
66
x: number;
@@ -31,7 +31,7 @@ export function NonSelectedCardMotion({ children, x, y, rotate }: PropsWithChild
3131
duration: 0.5,
3232
},
3333
}}
34-
className={cardStyle}
34+
className="absolute cursor-pointer"
3535
style={{
3636
transformStyle: 'preserve-3d',
3737
transformOrigin: 'center center',
@@ -66,7 +66,7 @@ export function SelectedCardMotion({ children, x, y, rotate }: PropsWithChildren
6666
stiffness: 70,
6767
},
6868
}}
69-
className={cx('selected-card', selectedCardStyle)}
69+
className={cn('selected-card w-[40vw] max-w-[400px]')}
7070
style={{
7171
transformStyle: 'preserve-3d',
7272
transformOrigin: 'center center',
@@ -78,11 +78,6 @@ export function SelectedCardMotion({ children, x, y, rotate }: PropsWithChildren
7878
);
7979
}
8080

81-
const selectedCardStyle = css({
82-
width: '40vw',
83-
maxWidth: '400px',
84-
});
85-
8681
export function DrawingCardMotion({
8782
children,
8883
x,
@@ -115,7 +110,7 @@ export function DrawingCardMotion({
115110
delay: index * 0.1,
116111
},
117112
}}
118-
className={cardStyle}
113+
className="absolute cursor-pointer"
119114
onClick={onClick}
120115
style={{
121116
transformStyle: 'preserve-3d',
@@ -131,8 +126,3 @@ export function DrawingCardMotion({
131126
</motion.div>
132127
);
133128
}
134-
135-
const cardStyle = css({
136-
position: 'absolute',
137-
cursor: 'pointer',
138-
});

apps/webview/src/components/CardGame/FanDrawingGame/FanDrawingGame.tsx

Lines changed: 27 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
import { useEffect, useState } from 'react';
66
import { 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';
98
import { motion } from 'framer-motion';
9+
import { cn } from '@gitanimals/ui-tailwind/utils';
1010

1111
import { AnimalCard } from '@/components/AnimalCard';
1212
import { 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

190202
function 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

Comments
 (0)