-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharticle-detail-frame.tsx
More file actions
59 lines (52 loc) · 1.7 KB
/
Copy patharticle-detail-frame.tsx
File metadata and controls
59 lines (52 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import Link from "next/link";
import { Button } from "@repo/ui/components/button";
import type { ArticleDetail } from "../api/articles-api";
type ArticleDetailHeaderProps = {
article: ArticleDetail | null;
};
type EmptyStateProps = {
title: string;
description: string;
};
function formatDate(value: string) {
return new Intl.DateTimeFormat("en", { dateStyle: "medium" }).format(
new Date(value),
);
}
export function ArticleDetailHeader({ article }: ArticleDetailHeaderProps) {
return (
<header className="border-b border-border/80 px-5 py-4 lg:px-7 lg:py-5 xl:px-8">
<div className="mx-auto flex w-full max-w-5xl flex-wrap items-center justify-between gap-4">
<div>
<p className="text-reader-eyebrow text-foreground/42 uppercase">
Summary view
</p>
{article ? (
<p className="mt-1 text-reader-meta text-foreground/54">
{article.sourceTitle} · {formatDate(article.publishedAt)}
</p>
) : null}
</div>
{article ? (
<Button asChild className="shrink-0">
<Link href={article.originalUrl} target="_blank" rel="noreferrer">
Jump to original
</Link>
</Button>
) : null}
</div>
</header>
);
}
export function EmptyState({ title, description }: EmptyStateProps) {
return (
<div className="flex min-h-full items-center justify-center px-8 py-10 lg:px-12 lg:py-12">
<div className="max-w-sm text-center">
<p className="text-sm font-medium text-foreground/68">{title}</p>
<p className="mt-2 text-sm leading-6 text-foreground/54">
{description}
</p>
</div>
</div>
);
}