mirror of
https://github.com/vercel/next-learn.git
synced 2026-06-23 04:35:50 +00:00
Rename files
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import Head from 'next/head'
|
||||
import styles from './Layout.module.css'
|
||||
import styles from './layout.module.css'
|
||||
import utilStyles from '../styles/utils.module.css'
|
||||
import Link from 'next/link'
|
||||
|
||||
|
||||
6
api-routes-starter/components/date.js
Normal file
6
api-routes-starter/components/date.js
Normal file
@@ -0,0 +1,6 @@
|
||||
import { parseISO, format } from 'date-fns'
|
||||
|
||||
export default function Date({ dateString }) {
|
||||
const date = parseISO(dateString)
|
||||
return <time dateTime={dateString}>{format(date, 'LLLL d, yyyy')}</time>
|
||||
}
|
||||
64
api-routes-starter/components/layout.js
Normal file
64
api-routes-starter/components/layout.js
Normal file
@@ -0,0 +1,64 @@
|
||||
import Head from 'next/head'
|
||||
import styles from './layout.module.css'
|
||||
import utilStyles from '../styles/utils.module.css'
|
||||
import Link from 'next/link'
|
||||
|
||||
const name = '[Your Name]'
|
||||
export const siteTitle = 'Next.js Sample Website'
|
||||
|
||||
export default function Layout({ children, home }) {
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<Head>
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Learn how to build a personal website using Next.js"
|
||||
/>
|
||||
<meta
|
||||
property="og:image"
|
||||
content={`https://og-image.now.sh/${encodeURI(
|
||||
siteTitle
|
||||
)}.png?theme=light&md=0&fontSize=75px&images=https%3A%2F%2Fassets.zeit.co%2Fimage%2Fupload%2Ffront%2Fassets%2Fdesign%2Fnextjs-black-logo.svg`}
|
||||
/>
|
||||
</Head>
|
||||
<header className={styles.header}>
|
||||
{home ? (
|
||||
<>
|
||||
<img
|
||||
src="/images/profile.jpg"
|
||||
className={`${styles.headerHomeImage} ${utilStyles.borderCircle}`}
|
||||
alt={name}
|
||||
/>
|
||||
<h1 className={utilStyles.heading2Xl}>{name}</h1>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Link href="/">
|
||||
<a>
|
||||
<img
|
||||
src="/images/profile.jpg"
|
||||
className={`${styles.headerImage} ${utilStyles.borderCircle}`}
|
||||
alt={name}
|
||||
/>
|
||||
</a>
|
||||
</Link>
|
||||
<h2 className={utilStyles.headingLg}>
|
||||
<Link href="/">
|
||||
<a className={utilStyles.colorInherit}>{name}</a>
|
||||
</Link>
|
||||
</h2>
|
||||
</>
|
||||
)}
|
||||
</header>
|
||||
<main>{children}</main>
|
||||
{!home && (
|
||||
<div className={styles.backToHome}>
|
||||
<Link href="/">
|
||||
<a>← Back to home</a>
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
25
api-routes-starter/components/layout.module.css
Normal file
25
api-routes-starter/components/layout.module.css
Normal file
@@ -0,0 +1,25 @@
|
||||
.container {
|
||||
max-width: 36rem;
|
||||
padding: 0 1rem;
|
||||
margin: 3rem auto 6rem;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.headerImage {
|
||||
width: 6rem;
|
||||
height: 6rem;
|
||||
}
|
||||
|
||||
.headerHomeImage {
|
||||
width: 8rem;
|
||||
height: 8rem;
|
||||
}
|
||||
|
||||
.backToHome {
|
||||
margin: 3rem 0 0;
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
import Head from 'next/head'
|
||||
import Layout, { siteTitle } from '../components/Layout'
|
||||
import Layout, { siteTitle } from '../components/layout'
|
||||
import utilStyles from '../styles/utils.module.css'
|
||||
import { getSortedPostsData } from '../lib/posts'
|
||||
import Link from 'next/link'
|
||||
import Date from '../components/Date'
|
||||
import Date from '../components/date'
|
||||
|
||||
export default function Home({ allPostsData }) {
|
||||
return (
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Layout from '../../components/Layout'
|
||||
import Layout from '../../components/layout'
|
||||
import { getAllPostIds, getPostData } from '../../lib/posts'
|
||||
import Head from 'next/head'
|
||||
import Date from '../../components/Date'
|
||||
import Date from '../../components/date'
|
||||
import utilStyles from '../../styles/utils.module.css'
|
||||
|
||||
export default function Post({ postData }) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Head from 'next/head'
|
||||
import styles from './Layout.module.css'
|
||||
import styles from './layout.module.css'
|
||||
import utilStyles from '../styles/utils.module.css'
|
||||
import Link from 'next/link'
|
||||
|
||||
|
||||
6
basics-final/components/date.js
Normal file
6
basics-final/components/date.js
Normal file
@@ -0,0 +1,6 @@
|
||||
import { parseISO, format } from 'date-fns'
|
||||
|
||||
export default function Date({ dateString }) {
|
||||
const date = parseISO(dateString)
|
||||
return <time dateTime={dateString}>{format(date, 'LLLL d, yyyy')}</time>
|
||||
}
|
||||
64
basics-final/components/layout.js
Normal file
64
basics-final/components/layout.js
Normal file
@@ -0,0 +1,64 @@
|
||||
import Head from 'next/head'
|
||||
import styles from './layout.module.css'
|
||||
import utilStyles from '../styles/utils.module.css'
|
||||
import Link from 'next/link'
|
||||
|
||||
const name = 'Shu Uesugi'
|
||||
export const siteTitle = 'Next.js Sample Website'
|
||||
|
||||
export default function Layout({ children, home }) {
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<Head>
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Learn how to build a personal website using Next.js"
|
||||
/>
|
||||
<meta
|
||||
property="og:image"
|
||||
content={`https://og-image.now.sh/${encodeURI(
|
||||
siteTitle
|
||||
)}.png?theme=light&md=0&fontSize=75px&images=https%3A%2F%2Fassets.zeit.co%2Fimage%2Fupload%2Ffront%2Fassets%2Fdesign%2Fnextjs-black-logo.svg`}
|
||||
/>
|
||||
</Head>
|
||||
<header className={styles.header}>
|
||||
{home ? (
|
||||
<>
|
||||
<img
|
||||
src="/images/profile.jpg"
|
||||
className={`${styles.headerHomeImage} ${utilStyles.borderCircle}`}
|
||||
alt={name}
|
||||
/>
|
||||
<h1 className={utilStyles.heading2Xl}>{name}</h1>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Link href="/">
|
||||
<a>
|
||||
<img
|
||||
src="/images/profile.jpg"
|
||||
className={`${styles.headerImage} ${utilStyles.borderCircle}`}
|
||||
alt={name}
|
||||
/>
|
||||
</a>
|
||||
</Link>
|
||||
<h2 className={utilStyles.headingLg}>
|
||||
<Link href="/">
|
||||
<a className={utilStyles.colorInherit}>{name}</a>
|
||||
</Link>
|
||||
</h2>
|
||||
</>
|
||||
)}
|
||||
</header>
|
||||
<main>{children}</main>
|
||||
{!home && (
|
||||
<div className={styles.backToHome}>
|
||||
<Link href="/">
|
||||
<a>← Back to home</a>
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
25
basics-final/components/layout.module.css
Normal file
25
basics-final/components/layout.module.css
Normal file
@@ -0,0 +1,25 @@
|
||||
.container {
|
||||
max-width: 36rem;
|
||||
padding: 0 1rem;
|
||||
margin: 3rem auto 6rem;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.headerImage {
|
||||
width: 6rem;
|
||||
height: 6rem;
|
||||
}
|
||||
|
||||
.headerHomeImage {
|
||||
width: 8rem;
|
||||
height: 8rem;
|
||||
}
|
||||
|
||||
.backToHome {
|
||||
margin: 3rem 0 0;
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
import Head from 'next/head'
|
||||
import Layout, { siteTitle } from '../components/Layout'
|
||||
import Layout, { siteTitle } from '../components/layout'
|
||||
import utilStyles from '../styles/utils.module.css'
|
||||
import { getSortedPostsData } from '../lib/posts'
|
||||
import Link from 'next/link'
|
||||
import Date from '../components/Date'
|
||||
import Date from '../components/date'
|
||||
|
||||
export default function Home({ allPostsData }) {
|
||||
return (
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Layout from '../../components/Layout'
|
||||
import Layout from '../../components/layout'
|
||||
import { getAllPostIds, getPostData } from '../../lib/posts'
|
||||
import Head from 'next/head'
|
||||
import Date from '../../components/Date'
|
||||
import Date from '../../components/date'
|
||||
import utilStyles from '../../styles/utils.module.css'
|
||||
|
||||
export default function Post({ postData }) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Head from 'next/head'
|
||||
import styles from './Layout.module.css'
|
||||
import styles from './layout.module.css'
|
||||
import utilStyles from '../styles/utils.module.css'
|
||||
import Link from 'next/link'
|
||||
|
||||
|
||||
64
data-fetching-starter/components/layout.js
Normal file
64
data-fetching-starter/components/layout.js
Normal file
@@ -0,0 +1,64 @@
|
||||
import Head from 'next/head'
|
||||
import styles from './layout.module.css'
|
||||
import utilStyles from '../styles/utils.module.css'
|
||||
import Link from 'next/link'
|
||||
|
||||
const name = '[Your Name]'
|
||||
export const siteTitle = 'Next.js Sample Website'
|
||||
|
||||
export default function Layout({ children, home }) {
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<Head>
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Learn how to build a personal website using Next.js"
|
||||
/>
|
||||
<meta
|
||||
property="og:image"
|
||||
content={`https://og-image.now.sh/${encodeURI(
|
||||
siteTitle
|
||||
)}.png?theme=light&md=0&fontSize=75px&images=https%3A%2F%2Fassets.zeit.co%2Fimage%2Fupload%2Ffront%2Fassets%2Fdesign%2Fnextjs-black-logo.svg`}
|
||||
/>
|
||||
</Head>
|
||||
<header className={styles.header}>
|
||||
{home ? (
|
||||
<>
|
||||
<img
|
||||
src="/images/profile.jpg"
|
||||
className={`${styles.headerHomeImage} ${utilStyles.borderCircle}`}
|
||||
alt={name}
|
||||
/>
|
||||
<h1 className={utilStyles.heading2Xl}>{name}</h1>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Link href="/">
|
||||
<a>
|
||||
<img
|
||||
src="/images/profile.jpg"
|
||||
className={`${styles.headerImage} ${utilStyles.borderCircle}`}
|
||||
alt={name}
|
||||
/>
|
||||
</a>
|
||||
</Link>
|
||||
<h2 className={utilStyles.headingLg}>
|
||||
<Link href="/">
|
||||
<a className={utilStyles.colorInherit}>{name}</a>
|
||||
</Link>
|
||||
</h2>
|
||||
</>
|
||||
)}
|
||||
</header>
|
||||
<main>{children}</main>
|
||||
{!home && (
|
||||
<div className={styles.backToHome}>
|
||||
<Link href="/">
|
||||
<a>← Back to home</a>
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
25
data-fetching-starter/components/layout.module.css
Normal file
25
data-fetching-starter/components/layout.module.css
Normal file
@@ -0,0 +1,25 @@
|
||||
.container {
|
||||
max-width: 36rem;
|
||||
padding: 0 1rem;
|
||||
margin: 3rem auto 6rem;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.headerImage {
|
||||
width: 6rem;
|
||||
height: 6rem;
|
||||
}
|
||||
|
||||
.headerHomeImage {
|
||||
width: 8rem;
|
||||
height: 8rem;
|
||||
}
|
||||
|
||||
.backToHome {
|
||||
margin: 3rem 0 0;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import Head from 'next/head'
|
||||
import Layout, { siteTitle } from '../components/Layout'
|
||||
import Layout, { siteTitle } from '../components/layout'
|
||||
import utilStyles from '../styles/utils.module.css'
|
||||
|
||||
export default function Home() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Head from 'next/head'
|
||||
import Link from 'next/link'
|
||||
import Layout from '../../components/Layout'
|
||||
import Layout from '../../components/layout'
|
||||
|
||||
export default function FirstPost() {
|
||||
return (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Head from 'next/head'
|
||||
import styles from './Layout.module.css'
|
||||
import styles from './layout.module.css'
|
||||
import utilStyles from '../styles/utils.module.css'
|
||||
import Link from 'next/link'
|
||||
|
||||
|
||||
64
dynamic-routes-starter/components/layout.js
Normal file
64
dynamic-routes-starter/components/layout.js
Normal file
@@ -0,0 +1,64 @@
|
||||
import Head from 'next/head'
|
||||
import styles from './layout.module.css'
|
||||
import utilStyles from '../styles/utils.module.css'
|
||||
import Link from 'next/link'
|
||||
|
||||
const name = '[Your Name]'
|
||||
export const siteTitle = 'Next.js Sample Website'
|
||||
|
||||
export default function Layout({ children, home }) {
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<Head>
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Learn how to build a personal website using Next.js"
|
||||
/>
|
||||
<meta
|
||||
property="og:image"
|
||||
content={`https://og-image.now.sh/${encodeURI(
|
||||
siteTitle
|
||||
)}.png?theme=light&md=0&fontSize=75px&images=https%3A%2F%2Fassets.zeit.co%2Fimage%2Fupload%2Ffront%2Fassets%2Fdesign%2Fnextjs-black-logo.svg`}
|
||||
/>
|
||||
</Head>
|
||||
<header className={styles.header}>
|
||||
{home ? (
|
||||
<>
|
||||
<img
|
||||
src="/images/profile.jpg"
|
||||
className={`${styles.headerHomeImage} ${utilStyles.borderCircle}`}
|
||||
alt={name}
|
||||
/>
|
||||
<h1 className={utilStyles.heading2Xl}>{name}</h1>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Link href="/">
|
||||
<a>
|
||||
<img
|
||||
src="/images/profile.jpg"
|
||||
className={`${styles.headerImage} ${utilStyles.borderCircle}`}
|
||||
alt={name}
|
||||
/>
|
||||
</a>
|
||||
</Link>
|
||||
<h2 className={utilStyles.headingLg}>
|
||||
<Link href="/">
|
||||
<a className={utilStyles.colorInherit}>{name}</a>
|
||||
</Link>
|
||||
</h2>
|
||||
</>
|
||||
)}
|
||||
</header>
|
||||
<main>{children}</main>
|
||||
{!home && (
|
||||
<div className={styles.backToHome}>
|
||||
<Link href="/">
|
||||
<a>← Back to home</a>
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
25
dynamic-routes-starter/components/layout.module.css
Normal file
25
dynamic-routes-starter/components/layout.module.css
Normal file
@@ -0,0 +1,25 @@
|
||||
.container {
|
||||
max-width: 36rem;
|
||||
padding: 0 1rem;
|
||||
margin: 3rem auto 6rem;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.headerImage {
|
||||
width: 6rem;
|
||||
height: 6rem;
|
||||
}
|
||||
|
||||
.headerHomeImage {
|
||||
width: 8rem;
|
||||
height: 8rem;
|
||||
}
|
||||
|
||||
.backToHome {
|
||||
margin: 3rem 0 0;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import Head from 'next/head'
|
||||
import Layout, { siteTitle } from '../components/Layout'
|
||||
import Layout, { siteTitle } from '../components/layout'
|
||||
import utilStyles from '../styles/utils.module.css'
|
||||
import { getSortedPostsData } from '../lib/posts'
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Head from 'next/head'
|
||||
import Link from 'next/link'
|
||||
import Layout from '../../components/Layout'
|
||||
import Layout from '../../components/layout'
|
||||
|
||||
export default function FirstPost() {
|
||||
return (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Head from 'next/head'
|
||||
import styles from './Layout.module.css'
|
||||
import styles from './layout.module.css'
|
||||
import utilStyles from '../styles/utils.module.css'
|
||||
import Link from 'next/link'
|
||||
|
||||
|
||||
6
typescript-final/components/date.tsx
Normal file
6
typescript-final/components/date.tsx
Normal file
@@ -0,0 +1,6 @@
|
||||
import { parseISO, format } from 'date-fns'
|
||||
|
||||
export default function Date({ dateString }: { dateString: string }) {
|
||||
const date = parseISO(dateString)
|
||||
return <time dateTime={dateString}>{format(date, 'LLLL d, yyyy')}</time>
|
||||
}
|
||||
25
typescript-final/components/layout.module.css
Normal file
25
typescript-final/components/layout.module.css
Normal file
@@ -0,0 +1,25 @@
|
||||
.container {
|
||||
max-width: 36rem;
|
||||
padding: 0 1rem;
|
||||
margin: 3rem auto 6rem;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.headerImage {
|
||||
width: 6rem;
|
||||
height: 6rem;
|
||||
}
|
||||
|
||||
.headerHomeImage {
|
||||
width: 8rem;
|
||||
height: 8rem;
|
||||
}
|
||||
|
||||
.backToHome {
|
||||
margin: 3rem 0 0;
|
||||
}
|
||||
70
typescript-final/components/layout.tsx
Normal file
70
typescript-final/components/layout.tsx
Normal file
@@ -0,0 +1,70 @@
|
||||
import Head from 'next/head'
|
||||
import styles from './layout.module.css'
|
||||
import utilStyles from '../styles/utils.module.css'
|
||||
import Link from 'next/link'
|
||||
|
||||
const name = '[Your Name]'
|
||||
export const siteTitle = 'Next.js Sample Website'
|
||||
|
||||
export default function Layout({
|
||||
children,
|
||||
home
|
||||
}: {
|
||||
children: React.ReactNode
|
||||
home?: boolean
|
||||
}) {
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<Head>
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Learn how to build a personal website using Next.js"
|
||||
/>
|
||||
<meta
|
||||
property="og:image"
|
||||
content={`https://og-image.now.sh/${encodeURI(
|
||||
siteTitle
|
||||
)}.png?theme=light&md=0&fontSize=75px&images=https%3A%2F%2Fassets.zeit.co%2Fimage%2Fupload%2Ffront%2Fassets%2Fdesign%2Fnextjs-black-logo.svg`}
|
||||
/>
|
||||
</Head>
|
||||
<header className={styles.header}>
|
||||
{home ? (
|
||||
<>
|
||||
<img
|
||||
src="/images/profile.jpg"
|
||||
className={`${styles.headerHomeImage} ${utilStyles.borderCircle}`}
|
||||
alt={name}
|
||||
/>
|
||||
<h1 className={utilStyles.heading2Xl}>{name}</h1>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Link href="/">
|
||||
<a>
|
||||
<img
|
||||
src="/images/profile.jpg"
|
||||
className={`${styles.headerImage} ${utilStyles.borderCircle}`}
|
||||
alt={name}
|
||||
/>
|
||||
</a>
|
||||
</Link>
|
||||
<h2 className={utilStyles.headingLg}>
|
||||
<Link href="/">
|
||||
<a className={utilStyles.colorInherit}>{name}</a>
|
||||
</Link>
|
||||
</h2>
|
||||
</>
|
||||
)}
|
||||
</header>
|
||||
<main>{children}</main>
|
||||
{!home && (
|
||||
<div className={styles.backToHome}>
|
||||
<Link href="/">
|
||||
<a>← Back to home</a>
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
import Head from 'next/head'
|
||||
import Layout, { siteTitle } from '../components/Layout'
|
||||
import Layout, { siteTitle } from '../components/layout'
|
||||
import utilStyles from '../styles/utils.module.css'
|
||||
import { getSortedPostsData } from '../lib/posts'
|
||||
import Link from 'next/link'
|
||||
import Date from '../components/Date'
|
||||
import Date from '../components/date'
|
||||
import { GetStaticProps } from 'next'
|
||||
|
||||
export default function Home({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Layout from '../../components/Layout'
|
||||
import Layout from '../../components/layout'
|
||||
import { getAllPostIds, getPostData } from '../../lib/posts'
|
||||
import Head from 'next/head'
|
||||
import Date from '../../components/Date'
|
||||
import Date from '../../components/date'
|
||||
import utilStyles from '../../styles/utils.module.css'
|
||||
import { GetStaticProps, GetStaticPaths } from 'next'
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Head from 'next/head'
|
||||
import styles from './Layout.module.css'
|
||||
import styles from './layout.module.css'
|
||||
import utilStyles from '../styles/utils.module.css'
|
||||
import Link from 'next/link'
|
||||
|
||||
|
||||
6
typescript-starter/components/date.js
Normal file
6
typescript-starter/components/date.js
Normal file
@@ -0,0 +1,6 @@
|
||||
import { parseISO, format } from 'date-fns'
|
||||
|
||||
export default function Date({ dateString }) {
|
||||
const date = parseISO(dateString)
|
||||
return <time dateTime={dateString}>{format(date, 'LLLL d, yyyy')}</time>
|
||||
}
|
||||
64
typescript-starter/components/layout.js
Normal file
64
typescript-starter/components/layout.js
Normal file
@@ -0,0 +1,64 @@
|
||||
import Head from 'next/head'
|
||||
import styles from './layout.module.css'
|
||||
import utilStyles from '../styles/utils.module.css'
|
||||
import Link from 'next/link'
|
||||
|
||||
const name = '[Your Name]'
|
||||
export const siteTitle = 'Next.js Sample Website'
|
||||
|
||||
export default function Layout({ children, home }) {
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<Head>
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Learn how to build a personal website using Next.js"
|
||||
/>
|
||||
<meta
|
||||
property="og:image"
|
||||
content={`https://og-image.now.sh/${encodeURI(
|
||||
siteTitle
|
||||
)}.png?theme=light&md=0&fontSize=75px&images=https%3A%2F%2Fassets.zeit.co%2Fimage%2Fupload%2Ffront%2Fassets%2Fdesign%2Fnextjs-black-logo.svg`}
|
||||
/>
|
||||
</Head>
|
||||
<header className={styles.header}>
|
||||
{home ? (
|
||||
<>
|
||||
<img
|
||||
src="/images/profile.jpg"
|
||||
className={`${styles.headerHomeImage} ${utilStyles.borderCircle}`}
|
||||
alt={name}
|
||||
/>
|
||||
<h1 className={utilStyles.heading2Xl}>{name}</h1>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Link href="/">
|
||||
<a>
|
||||
<img
|
||||
src="/images/profile.jpg"
|
||||
className={`${styles.headerImage} ${utilStyles.borderCircle}`}
|
||||
alt={name}
|
||||
/>
|
||||
</a>
|
||||
</Link>
|
||||
<h2 className={utilStyles.headingLg}>
|
||||
<Link href="/">
|
||||
<a className={utilStyles.colorInherit}>{name}</a>
|
||||
</Link>
|
||||
</h2>
|
||||
</>
|
||||
)}
|
||||
</header>
|
||||
<main>{children}</main>
|
||||
{!home && (
|
||||
<div className={styles.backToHome}>
|
||||
<Link href="/">
|
||||
<a>← Back to home</a>
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
25
typescript-starter/components/layout.module.css
Normal file
25
typescript-starter/components/layout.module.css
Normal file
@@ -0,0 +1,25 @@
|
||||
.container {
|
||||
max-width: 36rem;
|
||||
padding: 0 1rem;
|
||||
margin: 3rem auto 6rem;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.headerImage {
|
||||
width: 6rem;
|
||||
height: 6rem;
|
||||
}
|
||||
|
||||
.headerHomeImage {
|
||||
width: 8rem;
|
||||
height: 8rem;
|
||||
}
|
||||
|
||||
.backToHome {
|
||||
margin: 3rem 0 0;
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
import Head from 'next/head'
|
||||
import Layout, { siteTitle } from '../components/Layout'
|
||||
import Layout, { siteTitle } from '../components/layout'
|
||||
import utilStyles from '../styles/utils.module.css'
|
||||
import { getSortedPostsData } from '../lib/posts'
|
||||
import Link from 'next/link'
|
||||
import Date from '../components/Date'
|
||||
import Date from '../components/date'
|
||||
|
||||
export default function Home({ allPostsData }) {
|
||||
return (
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Layout from '../../components/Layout'
|
||||
import Layout from '../../components/layout'
|
||||
import { getAllPostIds, getPostData } from '../../lib/posts'
|
||||
import Head from 'next/head'
|
||||
import Date from '../../components/Date'
|
||||
import Date from '../../components/date'
|
||||
import utilStyles from '../../styles/utils.module.css'
|
||||
|
||||
export default function Post({ postData }) {
|
||||
|
||||
Reference in New Issue
Block a user