Skip to content

Commit 561421a

Browse files
committed
Prettify 404.js
1 parent 2084b6f commit 561421a

File tree

2 files changed

+92
-6
lines changed

2 files changed

+92
-6
lines changed

src/pages/404.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import React from "react"
1+
import React from 'react';
22

3-
import Layout from "../components/layout"
4-
import SEO from "../components/seo"
3+
import Layout from '../components/layout';
4+
import SEO from '../components/seo';
55

66
const NotFoundPage = () => (
77
<Layout>
88
<SEO title="404: Not found" />
99
<h1>NOT FOUND</h1>
10-
<p>You just hit a route that doesn&#39;t exist... the sadness.</p>
10+
<p>You just hit a route that doesn't exist... the sadness.</p>
1111
</Layout>
12-
)
12+
);
1313

14-
export default NotFoundPage
14+
export default NotFoundPage;

src/pages/index.js

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import React, { useState } from 'react';
2+
3+
import Layout from '../components/layout';
4+
import SEO from '../components/seo';
5+
6+
const IndexPage = () => {
7+
const [email, setEmail] = useState('');
8+
9+
const handleSubmit = async e => {
10+
e.preventDefault();
11+
const emails = [{ email }];
12+
const response = await fetch('/.netlify/functions/submitEmailAddress', {
13+
body: JSON.stringify(emails),
14+
method: 'post',
15+
});
16+
17+
const body = await response.json();
18+
if (!body.error_count) {
19+
setEmail('');
20+
}
21+
};
22+
23+
return (
24+
<Layout>
25+
<SEO title="Home" keywords={[`gatsby`, `application`, `react`]} />
26+
<h1>Hi people</h1>
27+
<p>Coming soon: React and TypeScript documentation!</p>
28+
<form method="post" onSubmit={handleSubmit}>
29+
<label>
30+
Want an email when it's ready? Join my mailing list!
31+
<br />
32+
<input
33+
type="email"
34+
value={email}
35+
onChange={e => setEmail(e.target.value)}
36+
placeholder="email"
37+
required
38+
/>
39+
<button type="submit">Submit</button>
40+
</label>
41+
</form>
42+
<p>
43+
Visit the{' '}
44+
<a
45+
href="https://github.com/AryanJ-NYC/reactandtypescript.dev"
46+
target="_blank"
47+
rel="noopener noreferrer"
48+
>
49+
GitHub repository
50+
</a>{' '}
51+
to contribute!
52+
</p>
53+
<p>
54+
If you're looking for immediate React and TypeScript help, please visit{' '}
55+
<a
56+
href="https://twitter.com/swyx"
57+
target="_blank"
58+
rel="noopener noreferrer"
59+
>
60+
@swyx
61+
</a>
62+
's{' '}
63+
<a
64+
href="https://github.com/sw-yx/react-typescript-cheatsheet"
65+
target="_blank"
66+
rel="noopener noreferrer"
67+
>
68+
React TypeScript cheatsheet.
69+
</a>
70+
</p>
71+
<p>
72+
Lastly, tweet me at{' '}
73+
<a
74+
href="https://twitter.com/AryanJabbari"
75+
target="_blank"
76+
rel="noopener noreferrer"
77+
>
78+
@AryanJabbari
79+
</a>
80+
. Words of encouragement are always welcome!
81+
</p>
82+
</Layout>
83+
);
84+
};
85+
86+
export default IndexPage;

0 commit comments

Comments
 (0)