From e839a5f61f0faa21ca8b4bd5767f7575d5e576ee Mon Sep 17 00:00:00 2001 From: polwex Date: Wed, 21 May 2025 14:00:28 +0700 Subject: the card flip animation is legit --- src/pages/lang/[slug].tsx | 74 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 src/pages/lang/[slug].tsx (limited to 'src/pages/lang') diff --git a/src/pages/lang/[slug].tsx b/src/pages/lang/[slug].tsx new file mode 100644 index 0000000..11962a5 --- /dev/null +++ b/src/pages/lang/[slug].tsx @@ -0,0 +1,74 @@ +import { Button } from "@/components/ui/button"; +import { Link } from "waku"; + +import { getContextData } from "waku/middleware/context"; +import type { PageProps } from "waku/router"; +import db from "@/lib/db"; +import { Progress } from "@/components/ui/progress"; +import { + Card, + CardContent, + CardDescription, + CardHeader, + CardTitle, +} from "@/components/ui/card"; + +const flags: Record = { + th: "🇹🇭", + en: "🇬🇧", + zh: "🇨🇳", + ja: "🇯🇵", + es: "🇪🇸", + fr: "🇫🇷", +}; + +export default async function HomePage(props: PageProps<"/lang/[slug]">) { + const lessons = await getData(props.slug); + const { user } = getContextData(); + function commit() {} + + return ( + <> +
+

Thai!

+ {lessons.map((l) => ( + + + + +

{l.name}

+
+ +

{l.description}

+
+
+ + + +
+ + ))} +
+ + ); +} + +const getData = async (lang: string) => { + const lessons = db.fetchLanguage(lang); + + return lessons; +}; + +export const getConfig = async () => { + return { + render: "dynamic", + } as const; +}; + +async function LanguageItem({ lang }: { lang: string }) { + return ( +
+
{flags[lang] || ""}
+
+ ); +} -- cgit v1.2.3