Skip to content

Commit d7c749a

Browse files
committed
chore
1 parent c13ab67 commit d7c749a

File tree

8 files changed

+595
-34
lines changed

8 files changed

+595
-34
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
"author": "Scott Moss <willscottmoss@gmail.com>",
66
"license": "MIT",
77
"dependencies": {
8+
"@theme-ui/presets": "^0.3.0",
89
"next": "^9.5.0",
910
"react": "^16.13.1",
10-
"react-dom": "^16.13.1"
11+
"react-dom": "^16.13.1",
12+
"theme-ui": "^0.3.1"
1113
},
1214
"scripts": {
1315
"dev": "next",

pages/_app.jsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/** @jsx jsx */
2+
import { jsx } from 'theme-ui'
3+
import { ThemeProvider } from 'theme-ui'
4+
import theme from '../theme'
5+
import Nav from '../src/components/nav'
6+
7+
export default function App({ Component, pageProps }) {
8+
return (
9+
<ThemeProvider theme={theme}>
10+
<div>
11+
<Nav />
12+
<Component {...pageProps} />
13+
</div>
14+
</ThemeProvider>
15+
)
16+
}

pages/index.jsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import React from 'react'
1+
/** @jsx jsx */
2+
import { jsx } from 'theme-ui'
23
import Link from 'next/link'
34

45
export default () => (
5-
<div>
6-
<h1>Index page</h1>
7-
8-
<Link href="/notes">
9-
<a>Notes</a>
10-
</Link>
6+
<div sx={{ height: `calc(100vh - 60px)`}}>
7+
<div sx={{variant: 'containers.page', display: 'flex', alignItems: 'center', height: '100%'}}>
8+
<h1 sx={{fontSize: 8, my: 0}}>This is a really dope note taking app.</h1>
9+
</div>
1110
</div>
1211
)

pages/notes/[id].jsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React from 'react'
1+
/** @jsx jsx */
2+
import { jsx } from 'theme-ui'
23
import { useRouter } from 'next/router'
34
import Link from 'next/link'
45

@@ -7,12 +8,8 @@ export default () => {
78
const { id }= router.query
89

910
return (
10-
<div>
11+
<div sx={{variant: 'containers.page'}}>
1112
<h1>Note: {id} </h1>
12-
13-
<Link href="/notes">
14-
<a>Notes</a>
15-
</Link>
1613
</div>
1714
)
1815
}

pages/notes/index.jsx

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
1-
import React from 'react'
1+
/** @jsx jsx */
2+
import { jsx } from 'theme-ui'
23
import Link from 'next/link'
34

45
export default () => {
5-
const notes = new Array(15).fill(1).map((e, i) => ({id: i, title: `Note: ${i}`}))
6+
const notes = new Array(15).fill(1).map((e, i) => ({id: i, title: `This is my note ${i}`}))
67

78
return (
8-
<div>
9-
<h1>Notes</h1>
9+
<div sx={{variant: 'containers.page'}}>
10+
<h1>My Notes</h1>
1011

11-
{notes.map(note => (
12-
<div>
13-
<Link key={note.id} href="/notes/[id]" as={`/notes/${note.id}`}>
14-
<a>
15-
<strong>{note.title}</strong>
16-
</a>
17-
</Link>
18-
</div>
19-
))}
12+
<div sx={{display: 'flex', justifyContent: 'space-between', alignItems: 'center', flexWrap: 'wrap'}}>
13+
{notes.map(note => (
14+
<div sx={{width: '33%', p: 2}}>
15+
<Link key={note.id} href="/notes/[id]" as={`/notes/${note.id}`}>
16+
<a sx={{textDecoration: 'none', cursor: 'pointer'}}>
17+
<div sx={{variant: 'containers.card',}}>
18+
<strong>{note.title}</strong>
19+
</div>
20+
</a>
21+
</Link>
22+
</div>
23+
))}
24+
</div>
2025
</div>
2126
)
2227
}

src/components/nav.jsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/** @jsx jsx */
2+
import { jsx } from 'theme-ui'
3+
import Link from 'next/link'
4+
5+
const Nav = () => (
6+
<header sx={{height: '60px', width: '100vw', bg: 'primary', borderBottom: '1px solid', borderColor: 'primary'}}>
7+
<nav sx={{display: 'flex', alignItems: 'center', justifyContent: 'space-between', variant: 'containers.page', height: '100%'}}>
8+
<Link href="/">
9+
<a sx={{fontWeight: 'bold', fontSize: 4, cursor: 'pointer'}}>Note App</a>
10+
</Link>
11+
12+
<Link href="/notes">
13+
<a sx={{color: 'text', fontSize: 3, cursor: 'pointer'}}>notes</a>
14+
</Link>
15+
16+
</nav>
17+
</header>
18+
)
19+
20+
export default Nav

theme.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { roboto } from '@theme-ui/presets'
2+
3+
const theme = {
4+
...roboto,
5+
containers: {
6+
card: {
7+
boxShadow: '0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24)',
8+
border: '1px solid',
9+
borderColor: 'muted',
10+
borderRadius: '4px',
11+
p: 2,
12+
},
13+
page: {
14+
width: '100%',
15+
maxWidth: '960px',
16+
m: 0,
17+
mx: 'auto',
18+
}
19+
},
20+
styles: {
21+
...roboto.styles
22+
}
23+
}
24+
25+
export default theme

0 commit comments

Comments
 (0)