Add basic components
This commit is contained in:
15
components/header/index.js
Normal file
15
components/header/index.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import Link from 'next/link';
|
||||||
|
|
||||||
|
const Header = () => (
|
||||||
|
<div>
|
||||||
|
<Link href="/">
|
||||||
|
<a title="Homepage">Home</a>
|
||||||
|
</Link>
|
||||||
|
|
|
||||||
|
<Link href="/about">
|
||||||
|
<a title="About Page">About Page</a>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
export default Header;
|
@ -1,9 +1,10 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Link from 'next/link';
|
import Header from '../components/header';
|
||||||
|
|
||||||
export default function About() {
|
export default function About() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
<Header />
|
||||||
<p>This is the about page</p>
|
<p>This is the about page</p>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
10
pages/home.js
Normal file
10
pages/home.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import Header from '../components/header';
|
||||||
|
|
||||||
|
export const Home = (props) => (
|
||||||
|
<div>
|
||||||
|
<Header />
|
||||||
|
<p>Hello Next.js</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
export default Home;
|
@ -1,12 +1,9 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Link from 'next/link';
|
import Home from './home';
|
||||||
|
|
||||||
const Index = () => (
|
const Index = () => (
|
||||||
<div>
|
<div>
|
||||||
<Link href="/about">
|
<Home />
|
||||||
<a title="About Page">About Page</a>
|
|
||||||
</Link>
|
|
||||||
<p>Hello Next.js</p>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user