Skip to content

Commit dbcf2ab

Browse files
committed
[BLD-328] Portal: Update changelog page layout
1 parent ed47e93 commit dbcf2ab

File tree

9 files changed

+62
-82
lines changed

9 files changed

+62
-82
lines changed

apps/portal/src/app/changelog/[slug]/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export default function Layout(props: { children: React.ReactNode }) {
22
return (
3-
<main className="container max-w-3xl py-10" data-noindex>
3+
<main className="container max-w-4xl py-10" data-noindex>
44
{props.children}
55
</main>
66
);

apps/portal/src/app/changelog/[slug]/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default async function Page(props: {
2525

2626
return (
2727
<div className="changelog-page">
28-
<Button asChild>
28+
<Button asChild variant="ghost">
2929
<Link
3030
className="-translate-x-1/4 !p-2 !text-muted-foreground hover:!text-foreground mb-4 bg-transparent"
3131
href="/changelog"
@@ -64,7 +64,7 @@ export default async function Page(props: {
6464
})}
6565
</div>
6666

67-
<div className="mb-8 border-t-2" />
67+
<div className="mb-8 border-t border-dashed" />
6868

6969
{ReactHtmlParser(data.html || "", {
7070
transform,

apps/portal/src/app/changelog/components/Author.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@ export function Author(props: { name: string; profileImage?: string | null }) {
66
{props.profileImage && (
77
<img
88
alt=""
9-
className="size-8 rounded-[50%] border"
9+
className="size-6 rounded-[50%] border"
1010
src={props.profileImage}
1111
/>
1212
)}
13-
<span className="font-medium text-muted-foreground text-sm">
14-
{props.name}
15-
</span>
13+
<span className="text-muted-foreground text-sm">{props.name}</span>
1614
</div>
1715
);
1816
}

apps/portal/src/app/changelog/components/ChangeLogIndexTOC.tsx

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
import { formatDistance } from "date-fns";
1+
import { formatDate } from "date-fns";
22
import { cn } from "../../../lib/utils";
33

44
export function RenderDate(props: { iso: string; className?: string }) {
55
return (
6-
<time
7-
className={cn(
8-
"font-medium text-muted-foreground text-sm",
9-
props.className,
10-
)}
11-
dateTime={props.iso}
12-
>
13-
{formatDistance(new Date(props.iso), new Date())} ago
6+
<time className={cn("text-sm", props.className)} dateTime={props.iso}>
7+
{formatDate(new Date(props.iso), "MMM d, yyyy")}
148
</time>
159
);
1610
}

apps/portal/src/app/changelog/page.tsx

Lines changed: 41 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import { createMetadata } from "@doc";
22
import GithubSlugger from "github-slugger";
3-
import { PlusIcon } from "lucide-react";
43
import Link from "next/link";
54
import ReactHtmlParser from "react-html-parser";
65
import { Heading } from "@/components/Document";
7-
import { Author } from "./components/Author";
8-
import { ChangelogIndexTOC } from "./components/ChangeLogIndexTOC";
96
import { RenderDate } from "./components/RenderData";
107
import { fetchChangeLogs, fetchPost } from "./ghost";
118
import { transform } from "./utils/transform";
@@ -23,12 +20,15 @@ export const metadata = createMetadata({
2320

2421
export default async function Page() {
2522
return (
26-
<main className="container" data-noindex>
27-
<div className="flex justify-between gap-16">
28-
<div className="w-full max-w-[850px] grow-0 ">
29-
<PageContent />
23+
<main data-noindex>
24+
<div className="border-b py-12 border-dashed">
25+
<div className="container">
26+
<h1 className="font-semibold text-4xl tracking-tight">Changelog</h1>
3027
</div>
31-
<ChangelogIndexTOC />
28+
</div>
29+
30+
<div className="container">
31+
<PageContent />
3232
</div>
3333
</main>
3434
);
@@ -39,53 +39,46 @@ async function PageContent() {
3939
const slugger = new GithubSlugger();
4040

4141
return (
42-
<div className="changelog-page py-6">
43-
<h1 className="mb-10 font-semibold text-3xl tracking-tighter">
44-
Changelog
45-
</h1>
46-
47-
<div className="flex flex-col gap-10 xl:border-l-2 xl:pl-12">
42+
<div className="changelog-page overflow-hidden">
43+
<div className="flex flex-col gap-10 xl:border-l border-dashed xl:pl-16 max-w-4xl ml-auto pb-20">
4844
{posts.map((post) => {
4945
return (
50-
<div className="relative pb-10" key={post.id}>
51-
<div className="mb-2 flex items-center gap-5">
52-
{post.published_at && (
53-
<RenderDate className="text-base" iso={post.published_at} />
54-
)}
55-
<div className="flex gap-5">
56-
{post.authors?.map((author) => {
57-
return (
58-
<Author
59-
key={author.id}
60-
name={author.name || ""}
61-
profileImage={author.profile_image}
62-
/>
63-
);
64-
})}
46+
<div className="relative pt-10" key={post.id}>
47+
<div className="-left-16 -translate-x-full absolute top-12 hidden xl:flex gap-5 ml-3 items-center">
48+
<div className="hidden xl:block text-sm text-muted-foreground">
49+
<RenderDate iso={post.published_at} />
50+
</div>
51+
<div className="size-6 rounded-[50%] border bg-background flex items-center justify-center">
52+
<div className="size-2 bg-blue-500 rounded-full" />
6553
</div>
66-
</div>
67-
68-
<div className="-left-12 -translate-x-1/2 absolute top-12 hidden size-7 items-center justify-center rounded-[50%] bg-foreground md:size-10 xl:flex">
69-
<PlusIcon className="size-6 text-background" />
7054
</div>
7155

7256
<div>
73-
<Heading
74-
anchorClassName="[&>a]:hidden m-0 border-b pb-5 mb-5"
75-
anchorId={slugger.slug(post.title || "")}
76-
// eslint-disable-next-line tailwindcss/no-custom-classname
77-
className="changelog-title"
78-
level={2}
79-
>
80-
<Link
81-
className="!text-foreground font-bold text-3xl tracking-tighter hover:underline md:text-4xl xl:text-5xl"
82-
href={`/changelog/${post.slug}`}
83-
>
84-
{post.title}
85-
</Link>
86-
</Heading>
57+
{post.published_at && (
58+
<div className="xl:hidden inline-flex rounded-full border px-3 py-2 mb-4 text-muted-foreground text-xs bg-card">
59+
<RenderDate iso={post.published_at} />
60+
</div>
61+
)}
8762

88-
<RenderChangelogContent slug={post.slug} />
63+
<div className="space-y-3 mb-5">
64+
<Heading
65+
anchorClassName="[&>a]:hidden m-0"
66+
anchorId={slugger.slug(post.title || "")}
67+
// eslint-disable-next-line tailwindcss/no-custom-classname
68+
className="changelog-title"
69+
level={2}
70+
>
71+
<Link
72+
className="!text-foreground font-semibold text-3xl md:text-4xl tracking-tight hover:underline !leading-tight"
73+
href={`/changelog/${post.slug}`}
74+
>
75+
{post.title}
76+
</Link>
77+
</Heading>
78+
</div>
79+
<div className="text-muted-foreground">
80+
<RenderChangelogContent slug={post.slug} />
81+
</div>
8982
</div>
9083
</div>
9184
);

apps/portal/src/app/changelog/utils/transform.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export const transform: Transform = (node, index: number) => {
6464
node.attribs.class = "text-center text-sm text-muted-foreground";
6565
return;
6666
}
67-
return <Paragraph>{getChildren()}</Paragraph>;
67+
return <Paragraph className="leading-7">{getChildren()}</Paragraph>;
6868
}
6969

7070
if (node.name === "ul") {
@@ -77,7 +77,7 @@ export const transform: Transform = (node, index: number) => {
7777
}
7878
node.attribs.class = "rounded-lg";
7979
return (
80-
<div className="my-5 flex justify-center rounded-lg border p-4">
80+
<div className="my-6 flex justify-center rounded-lg border border-dashed p-2 bg-card/50">
8181
{convertNodeToElement(node, index, transform)}
8282
</div>
8383
);
@@ -109,7 +109,13 @@ export const transform: Transform = (node, index: number) => {
109109
// }
110110
}
111111
if (code) {
112-
return <CodeBlock code={code} lang={lang} />;
112+
return (
113+
<CodeBlock
114+
code={code}
115+
lang={lang}
116+
className="bg-card/50 border-dashed"
117+
/>
118+
);
113119
}
114120
}
115121

apps/portal/src/components/Document/DocImage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function DocImage(props: {
1515
return (
1616
<div
1717
className={cn(
18-
"my-4 flex justify-center rounded-lg border p-4",
18+
"my-4 flex justify-center rounded-lg border border-dashed p-4",
1919
props.containerClassName,
2020
)}
2121
>

apps/portal/src/components/Document/Heading.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export function Heading(props: {
3333
>
3434
<h2
3535
className={cn(
36-
"break-words font-medium text-xl text-foreground tracking-tight",
36+
"break-words font-semibold text-xl text-foreground tracking-tight",
3737
props.className,
3838
)}
3939
>
@@ -52,7 +52,7 @@ export function Heading(props: {
5252
>
5353
<h3
5454
className={cn(
55-
"break-words font-medium text-foreground text-xl",
55+
"break-words font-semibold text-foreground text-xl tracking-tight",
5656
props.className,
5757
)}
5858
>
@@ -71,7 +71,7 @@ export function Heading(props: {
7171
>
7272
<h4
7373
className={cn(
74-
"break-words font-medium text-foreground text-lg",
74+
"break-words font-semibold text-foreground text-lg tracking-tight",
7575
props.className,
7676
)}
7777
>

0 commit comments

Comments
 (0)