Skip to content

Commit e71872b

Browse files
Add: Layout component
1 parent de9d8a2 commit e71872b

File tree

5 files changed

+36
-173
lines changed

5 files changed

+36
-173
lines changed

components/Layout.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import Nav from "./Nav";
2+
import styles from "../styles/Layout.module.css";
3+
4+
export default function Layout({ children }) {
5+
return (
6+
<>
7+
<Nav />
8+
<div className={styles.container}>
9+
<main className={styles.main}>{children}</main>
10+
</div>
11+
</>
12+
);
13+
}

pages/_app.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
// import App from 'next/app'
2+
import Layout from "../components/Layout";
23
import "../styles/globals.css";
34

45
function MyApp({ Component, pageProps }) {
5-
return <Component {...pageProps} />;
6+
return (
7+
<Layout>
8+
<Component {...pageProps} />
9+
</Layout>
10+
);
611
}
712

813
// Only uncomment this method if you have blocking data requirements for

pages/index.js

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import Head from "next/head";
2-
import Nav from "../components/Nav";
32

43
export default function Home() {
54
return (
@@ -8,7 +7,6 @@ export default function Home() {
87
<title>Web Dev Path</title>
98
<link rel="icon" href="/favicon.ico" />
109
</Head>
11-
<Nav />
1210
<main>
1311
<h1 className="title">&lt; Web Dev wannabe? /&gt;</h1>
1412
<div className="description">
@@ -63,24 +61,6 @@ export default function Home() {
6361
</footer>
6462

6563
<style jsx>{`
66-
.container {
67-
min-height: 100vh;
68-
padding: 0 0.5rem;
69-
display: flex;
70-
flex-direction: column;
71-
justify-content: center;
72-
align-items: center;
73-
}
74-
75-
main {
76-
padding: 5rem 0;
77-
flex: 1;
78-
display: flex;
79-
flex-direction: column;
80-
justify-content: center;
81-
align-items: center;
82-
}
83-
8464
.divider {
8565
color: #000;
8666
background-color: #000;
@@ -200,21 +180,6 @@ export default function Home() {
200180
}
201181
}
202182
`}</style>
203-
204-
<style jsx global>{`
205-
html,
206-
body {
207-
padding: 0;
208-
margin: 0;
209-
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto,
210-
Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue,
211-
sans-serif;
212-
}
213-
214-
* {
215-
box-sizing: border-box;
216-
}
217-
`}</style>
218183
</div>
219184
);
220185
}

styles/Layout.module.css

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.container {
2+
min-height: 100vh;
3+
padding: 0 0.5rem;
4+
display: flex;
5+
flex-direction: column;
6+
justify-content: flex-start;
7+
align-items: center;
8+
}
9+
10+
.main {
11+
padding: 3rem 0;
12+
flex: 1;
13+
display: flex;
14+
flex-direction: column;
15+
justify-content: flex-start;
16+
align-items: center;
17+
}

styles/ResponsiveNavbar.module.css

Lines changed: 0 additions & 137 deletions
This file was deleted.

0 commit comments

Comments
 (0)