feat: news page is centered
This commit is contained in:
+24
-14
@@ -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,18 +276,25 @@ 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">
|
||||
{isArchived && (
|
||||
<Alert className="md:w-max">
|
||||
<InfoIcon />
|
||||
<AlertTitle>This page is archived</AlertTitle>
|
||||
<AlertDescription>It can be seen only by administrators. Make any edits to make it visible again.</AlertDescription>
|
||||
</Alert>
|
||||
)}
|
||||
{resolvedBlocks.map((block) => (
|
||||
<BlockRenderer key={block.id} block={block} />
|
||||
))}
|
||||
<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 />
|
||||
<AlertTitle>This page is archived</AlertTitle>
|
||||
<AlertDescription>It can be seen only by administrators. Make any edits to make it visible again.</AlertDescription>
|
||||
</Alert>
|
||||
)}
|
||||
{resolvedBlocks.map((block) => (
|
||||
<BlockRenderer key={block.id} block={block} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user