feat: basic pages system
This commit is contained in:
+22
-23
@@ -1,9 +1,13 @@
|
||||
import Footer from "@/components/footer";
|
||||
import Header from "@/components/header";
|
||||
import { Badge } from "@/components/ui/badge"
|
||||
import { getPages } from "@/lib/pages/repository";
|
||||
import { PageMeta } from "@/lib/pages/types";
|
||||
import { ArrowRight, Calendar, Globe2 } from "lucide-react";
|
||||
|
||||
export default function Home() {
|
||||
export default async function Home() {
|
||||
const news = await getPages("NEWS", "PUBLISHED", 5);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Header />
|
||||
@@ -32,29 +36,24 @@ export default function Home() {
|
||||
</div>
|
||||
<div className="flex flex-col gap-8 mt-8">
|
||||
<h1 className="underline underline-offset-8 decoration-2">Recent news</h1>
|
||||
<div className="flex flex-col gap-2">
|
||||
<h2 className="w-max hover:underline underline-offset-8 decoration-2 duration-200 cursor-pointer">Construction of the White House has started</h2>
|
||||
<div className="flex flex-row gap-8 items-center">
|
||||
<h3 className="flex gap-2 items-baseline"><Calendar size={18} />16 June, 2026</h3>
|
||||
<h3 className="flex gap-2 items-baseline"><Globe2 size={18} />Liberty City</h3>
|
||||
<div className="flex flex-row gap-4">
|
||||
<Badge>Liberty City</Badge>
|
||||
{
|
||||
news.length > 0 ? news.map((n) => (
|
||||
<div className="flex flex-col gap-2" key={n.id}>
|
||||
<h2 className="w-max hover:underline underline-offset-8 decoration-2 duration-200 cursor-pointer">{n.title}</h2>
|
||||
<div className="flex flex-row gap-8 items-center">
|
||||
<h3 className="flex gap-2 items-baseline"><Calendar size={18} />{(n.publishedAt)?.toString()}</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((i, tag) => (
|
||||
<Badge key={i}>{tag}</Badge>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex flex-col gap-2">
|
||||
<h2 className="w-max hover:underline underline-offset-8 decoration-2 duration-200 cursor-pointer">President Volokhov has visited the Liberty City Trainbuilding Plant</h2>
|
||||
<div className="flex flex-row gap-8 items-center">
|
||||
<h3 className="flex gap-2 items-baseline"><Calendar size={18} />16 June, 2026</h3>
|
||||
<h3 className="flex gap-2 items-baseline"><Globe2 size={18} />Liberty City</h3>
|
||||
<div className="flex flex-row gap-4">
|
||||
<Badge>President</Badge>
|
||||
<Badge>Liberty City</Badge>
|
||||
<Badge>Industry</Badge>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<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>
|
||||
), (
|
||||
<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>
|
||||
)) : <h2>There are no news yet...</h2>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<Footer />
|
||||
|
||||
Reference in New Issue
Block a user