Skip to content

Commit 50b8115

Browse files
committed
Clean up variables
1 parent 8c0dcfb commit 50b8115

File tree

5 files changed

+14
-24
lines changed

5 files changed

+14
-24
lines changed

components/Header.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import Link from 'next/link'
22

3-
export default function Header({ siteTitle = 'Demo Blog' }) {
3+
export default function Header() {
44
return (
55
<>
66
<header className="header">
77
<nav className="nav" role="navigation" aria-label="main navigation">
88
<Link href="/">
9-
<a>{siteTitle}</a>
9+
<a>Demo Blog</a>
1010
</Link>
1111
<Link href="/about">
1212
<a>About</a>

components/Layout.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@ import Head from 'next/head'
22

33
import Header from './Header'
44

5-
export default function Layout({
6-
children,
7-
pageTitle,
8-
description,
9-
siteTitle,
10-
...props
11-
}) {
5+
export default function Layout({ children, pageTitle, description, ...props }) {
126
return (
137
<>
148
<Head>
@@ -67,7 +61,7 @@ export default function Layout({
6761
}
6862
`}</style>
6963
<section className="layout">
70-
<Header siteTitle={siteTitle} />
64+
<Header />
7165
<div className="content">{children}</div>
7266
</section>
7367
<footer>

pages/about.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ import Layout from '../components/Layout'
33
const About = ({ title, description, ...props }) => {
44
return (
55
<>
6-
<Layout
7-
pathname="/about"
8-
pageTitle={`${title} | About`}
9-
description={description}
10-
>
6+
<Layout pageTitle={`${title} | About`} description={description}>
117
<h1 className="title">Welcome to this demo blog!</h1>
128

139
<p className="description">

pages/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import getPosts from '../utils/getPosts'
66
const Index = ({ posts, title, description, ...props }) => {
77
return (
88
<>
9-
<Layout pathname="/" pageTitle={title} description={description}>
9+
<Layout pageTitle={title} description={description}>
1010
<h1 className="title">Welcome to this demo blog!</h1>
1111

1212
<p className="description">

pages/post/[postname].js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,29 @@ import ReactMarkdown from 'react-markdown'
55
import Layout from '../../components/Layout'
66
import getSlugs from '../../utils/getSlugs'
77

8-
export default function BlogTemplate(props) {
9-
if (!props.frontmatter) return <></>
8+
export default function BlogPost({ siteTitle, frontmatter, markdownBody }) {
9+
if (!frontmatter) return <></>
1010

1111
return (
1212
<>
13-
<Layout pageTitle={`${props.siteTitle} | ${props.frontmatter.title}`}>
13+
<Layout pageTitle={`${siteTitle} | ${frontmatter.title}`}>
1414
<div className="back">
1515
{' '}
1616
<Link href="/">
1717
<a>Back to post list</a>
1818
</Link>
1919
</div>
2020
<article>
21-
<h1>{props.frontmatter.title}</h1>
22-
{props.frontmatter.hero_image && (
21+
<h1>{frontmatter.title}</h1>
22+
{frontmatter.hero_image && (
2323
<img
24-
src={props.frontmatter.hero_image}
24+
src={frontmatter.hero_image}
2525
className="hero"
26-
alt={props.frontmatter.title}
26+
alt={frontmatter.title}
2727
/>
2828
)}
2929
<div>
30-
<ReactMarkdown source={props.markdownBody} />
30+
<ReactMarkdown source={markdownBody} />
3131
</div>
3232
</article>
3333
</Layout>

0 commit comments

Comments
 (0)