Complete "Layout Routes".
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
import React from "react";
|
||||
import type { Metadata } from "next";
|
||||
import React, { Suspense } from "react";
|
||||
|
||||
import "./globals.css";
|
||||
import Form from "next/form";
|
||||
import ContactList from "@/app/sidebar-contacts";
|
||||
import { getContacts } from "@/app/data";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Next.js Address Book",
|
||||
@@ -16,42 +13,11 @@ export default function RootLayout({
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
const contacts = getContacts();
|
||||
|
||||
return (
|
||||
<html lang="en">
|
||||
<body>
|
||||
<div id="sidebar">
|
||||
<h1>React Router Contacts</h1>
|
||||
<div>
|
||||
<Form id="search-form" role="search" action="." formMethod="get">
|
||||
<input
|
||||
aria-label="Search contacts"
|
||||
id="q"
|
||||
name="q"
|
||||
placeholder="Search"
|
||||
type="search"
|
||||
/>
|
||||
<div
|
||||
aria-hidden
|
||||
hidden={true}
|
||||
id="search-spinner"
|
||||
/>
|
||||
</Form>
|
||||
<Form action="." formMethod="post">
|
||||
<button type="submit">New</button>
|
||||
</Form>
|
||||
</div>
|
||||
<nav>
|
||||
<Suspense fallback={<div>Loading...</div>}>
|
||||
<ContactList contacts={contacts}/>
|
||||
</Suspense>
|
||||
</nav>
|
||||
</div>
|
||||
<div id={'detail'}>
|
||||
{children}
|
||||
</div>
|
||||
{children}
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user