Skip to content

Commit 739f5a3

Browse files
committed
chore: Create layout components
1 parent b33d2fd commit 739f5a3

File tree

5 files changed

+46
-31
lines changed

5 files changed

+46
-31
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import HeadComponent from '../head'
2+
3+
export default function Page ({ children }) {
4+
return (
5+
<div style={{
6+
height: '100vh',
7+
width: '100%' }}
8+
>
9+
<HeadComponent />
10+
{ children }
11+
</div>
12+
)
13+
}
Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
import Link from 'next/link'
2+
import Page from '@/common/layout/page'
23
import { Inter } from 'next/font/google'
34
import styles from '@/styles/Home.module.css'
45

56
const inter = Inter({ subsets: ['latin'] })
67

78
export default function HomeComponent() {
89
return (
9-
<main className={styles.main}>
10-
<div className={styles.description}>
11-
<div className={styles.h2}>
12-
<h1 className={inter.className}>
13-
React Hooks Playground
14-
</h1>
15-
</div>
10+
<Page>
11+
<main className={styles.main}>
12+
<div className={styles.description}>
13+
<div className={styles.h2}>
14+
<h1 className={inter.className}>
15+
React Hooks Playground
16+
</h1>
17+
</div>
1618

17-
<Link href="/usesyncexternalstore" className={styles.card}>
18-
useSyncExternalStore
19-
</Link>
20-
</div>
21-
</main>
19+
<Link href="/usesyncexternalstore" className={styles.card}>
20+
useSyncExternalStore
21+
</Link>
22+
</div>
23+
</main>
24+
</Page>
2225
)
2326
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import Page from '@/common/layout/page'
2+
3+
function UseSyncExternalStoreComponent () {
4+
return (
5+
<Page>
6+
<h2>
7+
UseSyncExternalStoreComponent
8+
</h2>
9+
</Page>
10+
)
11+
}
12+
13+
export default UseSyncExternalStoreComponent

client/src/pages/index.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
import HeadComponent from '@/common/layout/head'
21
import HomeComponent from '@/components/home'
32

43
export default function Home() {
5-
return (
6-
<>
7-
<HeadComponent />
8-
<HomeComponent />
9-
</>
10-
)
4+
return (<HomeComponent />)
115
}
Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
1-
import HeadComponent from '@/common/layout/head'
1+
import UseSyncExternalStoreComponent from '@/components/usesyncexternalstore'
22

3-
function useSyncExternalStoreContainer () {
4-
return (
5-
<>
6-
<HeadComponent />
7-
8-
<h2>
9-
useSyncExternalStoreContainer
10-
</h2>
11-
</>
12-
)
3+
function UseSyncExternalStore () {
4+
return (<UseSyncExternalStoreComponent />)
135
}
146

15-
export default useSyncExternalStoreContainer
7+
export default UseSyncExternalStore

0 commit comments

Comments
 (0)