-
-
Notifications
You must be signed in to change notification settings - Fork 169
Expand file tree
/
Copy pathLayout.tsx
More file actions
72 lines (63 loc) · 1.78 KB
/
Copy pathLayout.tsx
File metadata and controls
72 lines (63 loc) · 1.78 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
60
61
62
63
64
65
66
67
68
69
70
71
72
"use client";
import type { ReactNode } from "react";
import Link from "next/link";
interface BreadcrumbItem {
label: string;
href?: string;
}
interface ContentDetailLayoutProps {
breadcrumbs: BreadcrumbItem[];
children: ReactNode;
actionBar?: ReactNode;
discussion?: ReactNode;
sideInfo?: ReactNode;
}
const ContentDetailLayout = ({
breadcrumbs,
children,
actionBar,
discussion,
sideInfo,
}: ContentDetailLayoutProps) => {
return (
<div className="mx-auto max-w-3xl px-0 py-4 sm:px-4 sm:py-8">
{/* Breadcrumb navigation */}
{breadcrumbs.length > 0 && (
<nav
aria-label="Breadcrumb"
className="mb-6 flex items-center gap-2 text-sm text-muted"
>
{breadcrumbs.map((item, index) => (
<span key={index} className="flex items-center gap-2">
{index > 0 && <span aria-hidden="true">/</span>}
{item.href ? (
<Link href={item.href} className="hover:text-fg">
{item.label}
</Link>
) : (
<span className="text-fg">{item.label}</span>
)}
</span>
))}
</nav>
)}
{/* Main content card */}
<article className="rounded-lg border border-hairline bg-surface p-6">
{children}
{/* Action bar */}
{actionBar && (
<div className="mt-6 border-t border-hairline pt-4">{actionBar}</div>
)}
</article>
{/* Side info (author bio or source info) */}
{sideInfo && <div className="mt-6">{sideInfo}</div>}
{/* Discussion section */}
{discussion && (
<section id="discussion" className="mt-6">
{discussion}
</section>
)}
</div>
);
};
export default ContentDetailLayout;