feat: news page is centered

This commit is contained in:
Ivan Rezchikov
2026-07-17 12:14:25 +03:00
parent 15f3429de9
commit e957879212
2 changed files with 25 additions and 14 deletions
+14 -4
View File
@@ -14,6 +14,7 @@ import { getNavLinkByPageId } from "@/lib/navlinks/repository";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
import { Metadata } from "next";
import { getImageUrl } from "@/lib/image";
import { Badge } from "@/components/ui/badge";
function makeDescription(text?: string, maxLength = 160) {
if (!text) return undefined;
@@ -127,7 +128,7 @@ function BlockRenderer({ block }: { block: Block }) {
case "CALLOUT":
return (
<Alert className="md:w-max">
<Alert className="max-w-xl">
<InfoIcon />
<AlertTitle>{b.title}</AlertTitle>
<AlertDescription>{b.text}</AlertDescription>
@@ -200,8 +201,8 @@ function BlockRenderer({ block }: { block: Block }) {
return <Separator />;
case "LINK":
return <Link href={b.href} target="_blank">
<Button variant="secondary" className="max-w-full">{b.label}</Button>
return <Link href={b.href} className="w-max " target="_blank">
<Button variant="secondary">{b.label}</Button>
</Link>
default:
@@ -249,6 +250,8 @@ export default async function Page({ params }: { params: Promise<{ type: string;
user?.isAdmin && wasUpdatedByOther && updatedBy
? `${updatedBy.firstName} ${updatedBy.secondName}`
: null,
tags: isNews ? page.meta.tags : null,
};
return (
@@ -273,8 +276,14 @@ export default async function Page({ params }: { params: Promise<{ type: string;
{meta.author && <p className="flex gap-1.5 items-center"><UserIcon size={16} />{meta.author}</p>}
{meta.updatedBy && <p className="flex gap-1.5 items-center"><UserIcon size={16} />Last update by {meta.updatedBy}</p>}
</div>
{isNews && (<div className="flex flex-row gap-4">
{((meta as PageMeta)?.tags)?.map((tag) => (
<Badge key={tag}>{tag}</Badge>
))}
</div>)}
</div>
<div className="flex flex-col gap-6">
<div className={cn(isNews && `max-w-2xl mx-auto`)}>
<div className="flex flex-col gap-6 [&>a+a]:-my-2.5">
{isArchived && (
<Alert className="md:w-max">
<InfoIcon />
@@ -287,5 +296,6 @@ export default async function Page({ params }: { params: Promise<{ type: string;
))}
</div>
</div>
</div>
);
}
+1
View File
@@ -1,6 +1,7 @@
import { NewsCard } from "@/components/news-card";
import { getPages } from "@/lib/pages/repository";
import { ArrowRightIcon } from "lucide-react";
import Image from "next/image";
import Link from "next/link";
export default async function Home() {