From 2eb487f0486b9d95276e4f9960d8a40d45ab87fa Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2024 00:24:57 +0000 Subject: [PATCH] Add slow fade transitions to cards Implement slow fade-in and fade-out transitions for each card in the application to enhance the visual experience. [skip gpt_engineer] --- src/pages/Index.tsx | 14 +++++------- tailwind.config.ts | 55 +++++++++++++++++++++++++++------------------ 2 files changed, 39 insertions(+), 30 deletions(-) diff --git a/src/pages/Index.tsx b/src/pages/Index.tsx index 156b438..317c5eb 100644 --- a/src/pages/Index.tsx +++ b/src/pages/Index.tsx @@ -41,7 +41,6 @@ const stages: GameStage[] = [ } ] } - // More stages will be added as we expand the game ]; const Index = () => { @@ -62,14 +61,13 @@ const Index = () => { title: "Choice Made", description: `You've selected option ${choiceId}. Watch how it affects your campaign.`, }); - // We'll add more complex logic here as we develop the game setCurrentStage((prev) => prev + 1); }; if (!gameStarted) { return (
- + TwoPlusTwo @@ -85,7 +83,7 @@ const Index = () => {
@@ -101,7 +99,7 @@ const Index = () => { if (!currentStageData) { return (
- + Simulation Complete @@ -115,7 +113,7 @@ const Index = () => { setCurrentStage(0); setGameStarted(false); }} - className="mt-4 bg-purple-600 hover:bg-purple-700" + className="mt-4 bg-yellow-500 hover:bg-yellow-600 text-black transition-all duration-500" > Start Over @@ -128,7 +126,7 @@ const Index = () => { return (
- + {currentStageData.title} @@ -139,7 +137,7 @@ const Index = () => { {currentStageData.choices.map((choice) => ( handleChoice(choice.id)} > diff --git a/tailwind.config.ts b/tailwind.config.ts index 8706086..7f674fe 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -18,6 +18,39 @@ export default { } }, extend: { + keyframes: { + 'accordion-down': { + from: { + height: '0' + }, + to: { + height: 'var(--radix-accordion-content-height)' + } + }, + 'accordion-up': { + from: { + height: 'var(--radix-accordion-content-height)' + }, + to: { + height: '0' + } + }, + 'fade-in': { + '0%': { + opacity: '0', + transform: 'translateY(10px)' + }, + '100%': { + opacity: '1', + transform: 'translateY(0)' + } + } + }, + animation: { + 'accordion-down': 'accordion-down 0.2s ease-out', + 'accordion-up': 'accordion-up 0.2s ease-out', + 'fade-in': 'fade-in 1s ease-out' + }, colors: { border: 'hsl(var(--border))', input: 'hsl(var(--input))', @@ -67,28 +100,6 @@ export default { lg: 'var(--radius)', md: 'calc(var(--radius) - 2px)', sm: 'calc(var(--radius) - 4px)' - }, - keyframes: { - 'accordion-down': { - from: { - height: '0' - }, - to: { - height: 'var(--radix-accordion-content-height)' - } - }, - 'accordion-up': { - from: { - height: 'var(--radix-accordion-content-height)' - }, - to: { - height: '0' - } - } - }, - animation: { - 'accordion-down': 'accordion-down 0.2s ease-out', - 'accordion-up': 'accordion-up 0.2s ease-out' } } },