cloudflare/vinext

Public

mirrored from https://github.com/cloudflare/vinextAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v0.0.9

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

examples/nextra-docs-template/app/layout.tsx

93lines · modecode

1import "./globals.css";
2import Link from "next/link";
3
4const navigation = [
5 { title: "Introduction", href: "/" },
6 { title: "Another Page", href: "/another" },
7 {
8 title: "Advanced",
9 href: "/advanced",
10 children: [{ title: "Satori", href: "/advanced/satori" }],
11 },
12];
13
14const navbarLinks = [
15 { title: "About", href: "/about" },
16 {
17 title: "Contact",
18 href: "https://twitter.com/shuding_",
19 external: true,
20 },
21];
22
23function Sidebar() {
24 return (
25 <aside className="sidebar">
26 <div className="sidebar-section">
27 {navigation.map((item) => (
28 <div key={item.href}>
29 <Link href={item.href} className="sidebar-link">
30 {item.title}
31 </Link>
32 {item.children?.map((child) => (
33 <Link
34 key={child.href}
35 href={child.href}
36 className="sidebar-link nested"
37 >
38 {child.title}
39 </Link>
40 ))}
41 </div>
42 ))}
43 </div>
44 </aside>
45 );
46}
47
48function Navbar() {
49 return (
50 <nav className="navbar">
51 <Link href="/" className="navbar-logo">
52 My Project
53 </Link>
54 <ul className="navbar-links">
55 {navbarLinks.map((link) => (
56 <li key={link.href}>
57 {link.external ? (
58 <a href={link.href} target="_blank" rel="noopener noreferrer">
59 {link.title} ↗
60 </a>
61 ) : (
62 <Link href={link.href}>{link.title}</Link>
63 )}
64 </li>
65 ))}
66 </ul>
67 </nav>
68 );
69}
70
71export default function RootLayout({
72 children,
73}: {
74 children: React.ReactNode;
75}) {
76 return (
77 <html lang="en">
78 <head>
79 <meta charSet="utf-8" />
80 <meta name="viewport" content="width=device-width, initial-scale=1" />
81 <title>Nextra Docs Template</title>
82 </head>
83 <body>
84 <Navbar />
85 <div className="docs-layout">
86 <Sidebar />
87 <main className="docs-content">{children}</main>
88 </div>
89 <footer className="footer">Nextra Docs Template</footer>
90 </body>
91 </html>
92 );
93}
94