Skip to content

Commit 0a1e63c

Browse files
committed
clean up
1 parent d07c5f0 commit 0a1e63c

File tree

8 files changed

+110
-46
lines changed

8 files changed

+110
-46
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
node_modules
2+
build/*
3+
lambda

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# How to use Netlify Form and Functions to submit data to Sanity.io
1+
# How to use Netlify Form and Functions to submist data to Sanity.io
22

33
This is a simple example of how you can use Forms and Functions in [Netlify](https://netlify.com) to submit data to your Sanity.io project.
44

build/index.html

+49-20
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,49 @@
1-
<form name="contact" method="POST" data-netlify="true">
2-
<p>
3-
<label>Your Name: <input type="text" name="name" /></label>
4-
</p>
5-
<p>
6-
<label>Your Email: <input type="email" name="email" /></label>
7-
</p>
8-
<p>
9-
<label>Your Role: <select name="role[]" multiple>
10-
<option value="leader">Leader</option>
11-
<option value="follower">Follower</option>
12-
</select></label>
13-
</p>
14-
<p>
15-
<label>Message: <textarea name="message"></textarea></label>
16-
</p>
17-
<p>
18-
<button type="submit">Send</button>
19-
</p>
20-
</form>
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
8+
<title>How to use Netlify Form and Functions to submist data to Sanity.io</title>
9+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.min.css">
10+
</head>
11+
<body>
12+
<div class="container">
13+
<div class="columns is-vcentered">
14+
<div class="column is-half is-offset-one-quarter">
15+
<h1 class="is-size-2">How to use Netlify Form and Functions to submist data to <a href="https://www.sanity.io">Sanity.io</a></h1>
16+
<form class="container" name="contact" method="POST" data-netlify="true">
17+
<div class="field">
18+
<label class="label">Your Name:
19+
<input class="input" type="text" name="name" />
20+
</label>
21+
</div>
22+
<div class="field">
23+
<label class="label">Your Email:
24+
<input class="input" type="email" name="email" />
25+
</label>
26+
</div>
27+
<div class="field">
28+
<label for="role[]" class="label">Your Role:</label>
29+
<div class="select is-multiple">
30+
<select name="role[]" multiple size="2">
31+
<option value="leader">Leader</option>
32+
<option value="follower">Follower</option>
33+
</select>
34+
</div>
35+
</div>
36+
<div class="field">
37+
<label class="label">Message:
38+
<textarea class="textarea" name="message"></textarea>
39+
</label>
40+
</div>
41+
<div class="field">
42+
<button class="button" type="submit">Send</button>
43+
</div>
44+
</form>
45+
</div>
46+
</div>
47+
</div>
48+
</body>
49+
</html>
File renamed without changes.

index.html

-20
This file was deleted.

lambda/submission-created.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
"description": "",
55
"main": "index.js",
66
"dependencies": {
7-
"@sanity/client": "^0.140.0",
8-
"netlify-cli": "^2.6.4"
7+
"@sanity/client": "^0.140.0"
98
},
109
"devDependencies": {
10+
"netlify-cli": "^2.6.4",
1111
"netlify-lambda": "^1.3.0"
1212
},
1313
"scripts": {
14-
"start": "netlify-lambda serve src",
15-
"build": "cp index.html build/index.html && netlify-lambda build src",
14+
"start": "netlify-lambda serve functions",
15+
"build": "cp src/index.html build/index.html && netlify-lambda build functions",
1616
"test": "echo \"Error: no test specified\" && exit 1"
1717
},
1818
"keywords": [],

src/index.html

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
8+
<title>How to use Netlify Form and Functions to submist data to Sanity.io</title>
9+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.min.css">
10+
</head>
11+
12+
<body>
13+
<section class="section level">
14+
<div class="container">
15+
<div class="columns is-vcentered is-centered">
16+
<div class="column is-half">
17+
<h1 class="is-size-2">How to use Netlify Form and Functions to submist data to <a href="https://www.sanity.io">Sanity.io</a></h1>
18+
<form name="contact" method="POST" data-netlify="true">
19+
<div class="field">
20+
<label class="label">Your Name:
21+
<input class="input" type="text" name="name" />
22+
</label>
23+
</div>
24+
<div class="field">
25+
<label class="label">Your Email:
26+
<input class="input" type="email" name="email" />
27+
</label>
28+
</div>
29+
<div class="field">
30+
<label for="role[]" class="label">Your Role:</label>
31+
<div class="select is-multiple">
32+
<select name="role[]" multiple size="2">
33+
<option value="leader">Leader</option>
34+
<option value="follower">Follower</option>
35+
</select>
36+
</div>
37+
</div>
38+
<div class="field">
39+
<label class="label">Message:
40+
<textarea class="textarea" name="message"></textarea>
41+
</label>
42+
</div>
43+
<div class="field">
44+
<button class="button is-primary is-medium" type="submit">Send</button>
45+
</div>
46+
</form>
47+
</div>
48+
</div>
49+
</div>
50+
</section>
51+
</body>
52+
53+
</html>

0 commit comments

Comments
 (0)