Files
eu/app/page.tsx
T

104 lines
4.5 KiB
TypeScript

import { NewsCard } from "@/components/news-card";
import { getPages } from "@/lib/pages/repository";
import { ArrowRightIcon } from "lucide-react";
import Link from "next/link";
export default async function Home() {
const news = await getPages("NEWS", "PUBLISHED", 5);
return (
<div className="flex flex-col p-4 md:p-16 gap-8 md:gap-16 mb-4 md:mb-0">
<h1>Welcome to the European Federation!</h1>
<div className="grid grid-cols-2 gap-4 md:hidden">
<Link href="/page/citizenship" className="col-span-2">
<div className="flex items-end h-64 p-4 rounded-lg bg-primary text-primary-foreground">
<h1 className="flex flex-row items-center gap-2 hover:gap-4 hover:duration-200 cursor-pointer">
Become a citizen<ArrowRightIcon size={30} />
</h1>
</div>
</Link>
<Link href="/page/president">
<div className="flex items-end h-28 p-2.5 rounded-lg bg-muted">
<h2 className="flex flex-row items-center gap-2 hover:gap-4 hover:duration-200 cursor-pointer">
Learn more about the President
</h2>
</div>
</Link>
<Link href="/page/government">
<div className="flex items-end h-28 p-2.5 rounded-lg bg-muted">
<h2 className="flex flex-row items-center gap-2 hover:gap-4 hover:duration-200 cursor-pointer">
Learn more about the Government
</h2>
</div>
</Link>
<Link href="/page/regions">
<div className="flex items-end h-28 p-2.5 rounded-lg bg-muted">
<h2 className="flex flex-row items-center gap-2 hover:gap-4 hover:duration-200 cursor-pointer">
Regions of the Federation
</h2>
</div>
</Link>
<Link href="/page/foreign-missions">
<div className="flex items-end h-28 p-2.5 rounded-lg bg-muted">
<h2 className="flex flex-row items-center gap-2 hover:gap-4 hover:duration-200 cursor-pointer">
Foreign missions of Europe
</h2>
</div>
</Link>
</div>
<div className="hidden md:grid grid-cols-[2fr_1fr_1fr_1fr] gap-8">
<Link href="/page/citizenship">
<div className="flex items-end h-64 p-4 rounded-lg bg-primary text-primary-foreground">
<h1 className="flex flex-row items-center gap-2 hover:gap-4 hover:duration-200 cursor-pointer">
Become a citizen<ArrowRightIcon size={30} />
</h1>
</div>
</Link>
<div className="grid grid-rows-2 gap-8">
<Link href="/page/president">
<div className="flex items-end h-28 p-2.5 rounded-lg bg-muted">
<h2 className="flex flex-row items-center gap-2 hover:gap-4 hover:duration-200 cursor-pointer">
Learn more about the President
</h2>
</div>
</Link>
<Link href="/page/government">
<div className="flex items-end h-28 p-2.5 rounded-lg bg-muted">
<h2 className="flex flex-row items-center gap-2 hover:gap-4 hover:duration-200 cursor-pointer">
Learn more about the Government
</h2>
</div>
</Link>
</div>
<div className="grid grid-rows-2 gap-8">
<Link href="/page/regions">
<div className="flex items-end h-28 p-2.5 rounded-lg bg-muted">
<h2 className="flex flex-row items-center gap-2 hover:gap-4 hover:duration-200 cursor-pointer">
Regions of the Federation
</h2>
</div>
</Link>
<Link href="/page/foreign-missions">
<div className="flex items-end h-28 p-2.5 rounded-lg bg-muted">
<h2 className="flex flex-row items-center gap-2 hover:gap-4 hover:duration-200 cursor-pointer">
Foreign missions of Europe
</h2>
</div>
</Link>
</div>
</div>
<div className="flex flex-col gap-8 mt-4 lg:mt-8">
<h1>Recent news</h1>
<div className="flex flex-col gap-6">
{
news.length > 0 ? news.map((n) => (
<NewsCard news={n} key={n.id} />
)) : <h2 className="text-muted-foreground">There are no news yet...</h2>
}
</div>
<Link href="/news"><h3 className="w-max flex flex-row items-center gap-2 hover:gap-2.5 hover:duration-200 cursor-pointer">See all news<ArrowRightIcon size={20} /></h3></Link>
</div>
</div>
);
}