This repository has been archived on 2024-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
wikipedia-game-solver/apps/website/app/[locale]/page.tsx
Théo LUDWIG 33b57bf173
All checks were successful
Chromatic / chromatic (push) Successful in 4m47s
CI / ci (push) Successful in 3m50s
CI / commitlint (push) Successful in 18s
Release / release (push) Successful in 1m0s
refactor: components struture
2024-07-31 15:46:01 +02:00

58 lines
1.6 KiB
TypeScript

import type { LocaleProps } from "@repo/i18n/config"
import { Link } from "@repo/ui/Design/Link"
import { Typography } from "@repo/ui/Design/Typography"
import { MainLayout } from "@repo/ui/Layout/MainLayout"
import {
fromLocaleToWikipediaLocale,
getWikipediaLink,
} from "@repo/wikipedia-game-solver/wikipedia-api"
import { WikipediaClient } from "@repo/wikipedia-game-solver/WikipediaClient"
import { useTranslations } from "next-intl"
import { unstable_setRequestLocale } from "next-intl/server"
import Image from "next/image"
import WikipediaLogo from "#public/images/Wikipedia-Logo.webp"
interface HomePageProps extends LocaleProps {}
const HomePage: React.FC<HomePageProps> = (props) => {
const { params } = props
// Enable static rendering
unstable_setRequestLocale(params.locale)
const t = useTranslations()
const localeWikipedia = fromLocaleToWikipediaLocale(params.locale)
return (
<MainLayout>
<section className="text-center">
<Typography as="h1" variant="h1">
{t("home.title")}
</Typography>
<Typography as="p" variant="text1" className="mt-3">
{t.rich("home.description", {
"wikipedia-link": (children) => {
return (
<Link href={getWikipediaLink(localeWikipedia)} target="_blank">
{children}
</Link>
)
},
})}
</Typography>
</section>
<section className="my-6 flex items-center justify-center">
<Image src={WikipediaLogo} alt="Wikipedia" className="w-72" />
</section>
<WikipediaClient />
</MainLayout>
)
}
export default HomePage