feat: improved news
This commit is contained in:
+6
-16
@@ -1,10 +1,11 @@
|
||||
import Footer from "@/components/footer";
|
||||
import Header from "@/components/header";
|
||||
import { NewsCard } from "@/components/newsCard";
|
||||
import { Badge } from "@/components/ui/badge"
|
||||
import { getPages } from "@/lib/pages/repository";
|
||||
import { PageMeta } from "@/lib/pages/types";
|
||||
import { formatDate } from "@/lib/utils";
|
||||
import { ArrowRight, Calendar, Globe2 } from "lucide-react";
|
||||
import { ArrowRightIcon, CalendarIcon, Globe2Icon } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
|
||||
export default async function Home() {
|
||||
@@ -17,7 +18,7 @@ export default async function Home() {
|
||||
<h1>Welcome to the <span className="underline underline-offset-8 decoration-2">European Federation</span>!</h1>
|
||||
<div className="grid grid-cols-[2fr_1fr_1fr_1fr] gap-8">
|
||||
<div className="flex items-end h-64 p-4 rounded-lg bg-[#00a2e8] text-white">
|
||||
<h1 className="flex flex-row items-center gap-2 hover:gap-4 hover:underline underline-offset-8 decoration-2 duration-200 cursor-pointer">Become a citizen<ArrowRight size={32} /></h1>
|
||||
<h1 className="flex flex-row items-center gap-2 hover:gap-4 hover:underline underline-offset-8 decoration-2 duration-200 cursor-pointer">Become a citizen<ArrowRightIcon size={30} /></h1>
|
||||
</div>
|
||||
<div className="grid grid-rows-2 gap-8">
|
||||
<div className="flex items-end h-28 p-2.5 rounded-lg bg-muted">
|
||||
@@ -41,22 +42,11 @@ export default async function Home() {
|
||||
<div className="flex flex-col gap-6">
|
||||
{
|
||||
news.length > 0 ? news.map((n) => (
|
||||
<div className="flex flex-col gap-2" key={n.id}>
|
||||
<Link href={`/news/${n.slug}`}><h2 className="w-max hover:underline underline-offset-8 decoration-2 duration-200 cursor-pointer">{n.title}</h2></Link>
|
||||
<div className="flex flex-row gap-8 items-center">
|
||||
<h3 className="flex gap-2 items-baseline"><Calendar size={18} />{formatDate(n.publishedAt)}</h3>
|
||||
<h3 className="flex gap-2 items-baseline"><Globe2 size={18} />{(n.meta as PageMeta)?.location}</h3>
|
||||
<div className="flex flex-row gap-4">
|
||||
{((n.meta as PageMeta)?.tags)?.map((tag) => (
|
||||
<Badge key={tag}>{tag}</Badge>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)) : <h2>There are no news yet...</h2>
|
||||
<NewsCard news={n} key={n.id} />
|
||||
)) : <h2 className="text-muted-foreground">There are no news yet...</h2>
|
||||
}
|
||||
</div>
|
||||
<Link href="/news"><h2 className="w-max flex flex-row items-center gap-2 hover:gap-4 hover:underline underline-offset-8 decoration-2 duration-200 cursor-pointer">See all news<ArrowRight size={32} /></h2></Link>
|
||||
<Link href="/news"><h3 className="w-max flex flex-row items-center gap-2 hover:gap-2.5 hover:underline underline-offset-8 decoration-2 duration-200 cursor-pointer">See all news<ArrowRightIcon size={20} /></h3></Link>
|
||||
</div>
|
||||
</div>
|
||||
<Footer />
|
||||
|
||||
Reference in New Issue
Block a user