Files
erika/components/leaderboard/leaderboard-shell.tsx
T

68 lines
1.8 KiB
TypeScript

import type { ReactNode } from "react";
import Image from "next/image";
import Link from "next/link";
import { ArrowLeft } from "lucide-react";
import { LeaderboardTabs } from "@/components/leaderboard/leaderboard-tabs";
import { Button } from "@/components/ui/button";
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import Background from "@/public/background/space.webp";
type LeaderboardShellProps = {
active: "xp" | "vc";
title: string;
description: string;
children: ReactNode;
};
export function LeaderboardShell({
active,
title,
description,
children,
}: LeaderboardShellProps) {
return (
<main className="dark relative min-h-screen overflow-hidden bg-background text-foreground">
<div className="pointer-events-none fixed inset-0" aria-hidden>
<Image
src={Background}
alt=""
fill
priority
sizes="100vw"
className="object-cover opacity-40"
/>
</div>
<div className="relative mx-auto flex w-full max-w-6xl flex-col gap-6 px-4 py-6 sm:px-6 lg:py-10">
<nav aria-label="ทางลัด" className="flex items-center">
<Button variant="ghost" asChild>
<Link href="/">
<ArrowLeft data-icon="inline-start" />
กลับหน้าหลัก
</Link>
</Button>
</nav>
<Card>
<CardHeader>
<CardTitle>
<h1 className="text-2xl font-semibold sm:text-3xl">{title}</h1>
</CardTitle>
<CardDescription className="max-w-2xl">{description}</CardDescription>
</CardHeader>
<CardContent>
<LeaderboardTabs active={active} />
</CardContent>
</Card>
{children}
</div>
</main>
);
}