Skip to content

Commit 33c1f4d

Browse files
2.0 Patterns
1 parent ade7d93 commit 33c1f4d

File tree

5 files changed

+28
-4
lines changed

5 files changed

+28
-4
lines changed

components/Layout.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import NavBar from "./NavBar";
2+
3+
export default function Layout({ children }) {
4+
return (
5+
<>
6+
<NavBar />
7+
<div>{children}</div>
8+
</>
9+
);
10+
}

components/Seo.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import Head from "next/head";
2+
3+
export default function Seo({ title }) {
4+
return (
5+
<Head>
6+
<title>{title} | Next Movies</title>
7+
</Head>
8+
);
9+
}

pages/_app.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import NavBar from "../components/NavBar";
1+
import Layout from "../components/Layout";
22
import "../styles/globals.css";
33

44
export default function MyApp({ Component, pageProps }) {
55
return (
6-
<>
7-
<NavBar />
6+
<Layout>
87
<Component {...pageProps} />
9-
</>
8+
</Layout>
109
);
1110
}

pages/about.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
import Seo from "../components/Seo";
2+
13
export default function Potato() {
24
return (
35
<div>
6+
<Seo title="About" />
47
<h1>About</h1>
58
</div>
69
);

pages/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
import Seo from "../components/Seo";
2+
13
export default function Home() {
24
return (
35
<div>
6+
<Seo title="Home" />
47
<h1 className="active">Hello</h1>
58
</div>
69
);

0 commit comments

Comments
 (0)