feat: improved news

This commit is contained in:
Ivan Rezchikov
2026-06-21 13:35:32 +03:00
parent 95fd6ae716
commit 48656b562a
13 changed files with 154 additions and 147 deletions
+2 -2
View File
@@ -46,7 +46,7 @@ export default function DraftsDialog({ drafts }: { drafts: Draft[]}) {
<div className="flex flex-col items-center gap-2">
{drafts.map((draft) => (
<div className="w-full flex flex-row items-center justify-between" key={draft.id}>
<h3 className="w-64 hover:underline underline-offset-8 decoration-2 duration-200 cursor-pointer truncate">
<h3 className="w-64 truncate">
{draft.title}
</h3>
<div className="flex flex-row items-center gap-2">
@@ -61,7 +61,7 @@ export default function DraftsDialog({ drafts }: { drafts: Draft[]}) {
))}
</div>
) : (
<h4>There are no drafts yet...</h4>
<h4 className="text-muted-foreground">There are no drafts yet...</h4>
)}
</DialogContent>
</Dialog>
+2 -1
View File
@@ -119,7 +119,7 @@ export default function Editor({
</Field>
<Field>
<FieldLabel htmlFor="type">Page type</FieldLabel>
<Select defaultValue={type} onValueChange={(e) => setType(e)}>
<Select defaultValue={type} onValueChange={(e) => setType(e)} disabled={true}>
<SelectTrigger>
<SelectValue placeholder="Type" />
</SelectTrigger>
@@ -139,6 +139,7 @@ export default function Editor({
value={slug}
onChange={(e) => setSlug(e.target.value)}
placeholder="page-slug"
disabled={true}
/>
</InputGroup>
</Field>
+24
View File
@@ -0,0 +1,24 @@
import { Page, PageMeta } from "@/lib/pages/types";
import { CalendarIcon, Globe2Icon } from "lucide-react";
import Link from "next/link";
import { Badge } from "./ui/badge";
import { formatDate } from "@/lib/utils";
export function NewsCard({ news }: { news: Page }) {
return (
<div className="flex flex-col gap-2">
<Link href={`/news/${news.slug}`} className="w-max">
<h2 className="hover:underline underline-offset-8 decoration-2 duration-200 cursor-pointer">{news.title}</h2>
</Link>
<div className="flex flex-row gap-8 items-center">
<p className="flex gap-2 items-center"><CalendarIcon size={16} />{formatDate(news.publishedAt)}</p>
{(news?.meta as PageMeta)?.location && <p className="flex gap-2 items-center"><Globe2Icon size={16} />{(news.meta as PageMeta)?.location}</p>}
<div className="flex flex-row gap-4">
{((news.meta as PageMeta)?.tags)?.map((tag) => (
<Badge key={tag}>{tag}</Badge>
))}
</div>
</div>
</div>
)
}