-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathLayout.tsx
More file actions
50 lines (46 loc) · 1.47 KB
/
Layout.tsx
File metadata and controls
50 lines (46 loc) · 1.47 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
import type React from "react";
import { Suspense } from "react";
import { Header } from "../Header/Header";
import { MobileMenu } from "../MobileMenu/MobileMenu";
import { Sidebar } from "../Sidebar/Sidebar";
import { TableOfContents } from "../TableOfContents/TableOfContents";
import styles from "./Layout.module.css";
type LayoutVariant = "home" | "docs";
interface LayoutProps {
children: React.ReactNode;
variant?: LayoutVariant;
title?: string;
}
export const Layout: React.FC<LayoutProps> = ({
children,
variant = "docs",
title,
}) => {
const layoutClass =
variant === "home" ? styles.homeLayout : styles.docsLayout;
const fullTitle = title
? `${title} | FUNSTACK Static`
: "FUNSTACK Static - docs";
return (
<div className={`${styles.layout} ${layoutClass}`}>
<title>{fullTitle}</title>
<meta property="og:title" content={fullTitle} />
<meta name="twitter:title" content={fullTitle} />
<Header menuSlot={<MobileMenu />} />
<div className={styles.main}>
{variant === "docs" && <Sidebar />}
<main
className={`${styles.content} ${variant === "docs" ? styles.mdxContent : ""}`}
data-mdx-content={variant === "docs" ? "" : undefined}
>
<Suspense fallback={null}>{children}</Suspense>
</main>
{variant === "docs" && (
<aside className={styles.tocContainer}>
<TableOfContents />
</aside>
)}
</div>
</div>
);
};