From 274a7bbb1f82e99cdc9876f6d0de430585282797 Mon Sep 17 00:00:00 2001 From: polwex Date: Sat, 16 Aug 2025 13:38:27 +0700 Subject: beautiful flip animation by chatgpt --- src/components/tones/ToneSelectorClient.tsx | 119 +++++++++++++++++++--------- 1 file changed, 81 insertions(+), 38 deletions(-) (limited to 'src/components/tones/ToneSelectorClient.tsx') diff --git a/src/components/tones/ToneSelectorClient.tsx b/src/components/tones/ToneSelectorClient.tsx index 48580a4..8abbd38 100644 --- a/src/components/tones/ToneSelectorClient.tsx +++ b/src/components/tones/ToneSelectorClient.tsx @@ -27,7 +27,7 @@ import { Label } from "@/components/ui/label"; import { Skeleton } from "@/components/ui/skeleton"; // For loading state import { MutationOrder, ToneQuery } from "@/lib/types/phonetics"; import { ProsodySyllable } from "@/lib/types/cards"; -import { ArrowLeft, ArrowRight, Volume2 } from "lucide-react"; +import { ArrowLeft, ArrowRight, Volume2, FlipHorizontal2 } from "lucide-react"; function getColorByTone(tone: string): string { if (tone === "mid") return "blue"; @@ -192,43 +192,86 @@ type IProps = { goNext: () => void; }; function Inner({ isLoading, currentWord, goPrev, goNext }: IProps) { - return isLoading ? ( - - - - - - - - - - - ) : currentWord ? ( - - - Current Word - - - - {/* You can add more details from WordData here if needed, like definitions */} - - - - - - - ) : ( - - - No Word Found - - -

- Could not find a Thai word matching your criteria. Try different - selections. -

-
-
+ const [isFlipped, setIsFlipped] = useState(false); + const toggleFlip = () => setIsFlipped((f) => !f); + + if (isLoading) { + return ( + + + + + + + + + + + ); + } + + if (!currentWord) { + return ( + + + No Word Found + + +

+ Could not find a Thai word matching your criteria. Try different + selections. +

+
+
+ ); + } + + return ( +
+ +
+ {/* Front */} +
+
+

Current Word

+
+
+ +
+
+ + +
+
+ + {/* Back */} +
+
+

Details

+
+
+ {/* Placeholder for user-provided data */} +
+              {JSON.stringify(currentWord, null, 2)}
+            
+
+
+ Back of card – replace with your data +
+
+
+
); } -- cgit v1.2.3