Skip to content

Commit 21af438

Browse files
committed
feature: add basic form ui
1 parent c68d3ac commit 21af438

File tree

2 files changed

+53
-25
lines changed

2 files changed

+53
-25
lines changed

src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import HelloWorld from './components/HelloWorld.vue'
66

77
<template>
88
<img alt="Vue logo" src="./assets/logo.png" />
9-
<HelloWorld msg="Hello Vue 3 + Vite" />
9+
<HelloWorld />
1010
</template>
1111

1212
<style>

src/components/HelloWorld.vue

Lines changed: 52 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,68 @@
11
<script setup>
2-
import { ref } from 'vue'
2+
import { reactive } from 'vue'
33
44
defineProps({
55
msg: String
66
})
77
8-
const count = ref(0)
8+
const data = reactive({
9+
name: '',
10+
email: '',
11+
message: ''
12+
})
913
</script>
1014

1115
<template>
12-
<h1>{{ msg }}</h1>
13-
14-
<p>
15-
Recommended IDE setup:
16-
<a href="https://code.visualstudio.com/" target="_blank">VSCode</a>
17-
+
18-
<a href="https://github.com/johnsoncodehk/volar" target="_blank">Volar</a>
19-
</p>
20-
21-
<p>
22-
<a href="https://vitejs.dev/guide/features.html" target="_blank">
23-
Vite Documentation
24-
</a>
25-
|
26-
<a href="https://v3.vuejs.org/" target="_blank">Vue 3 Documentation</a>
27-
</p>
28-
29-
<button type="button" @click="count++">count is: {{ count }}</button>
30-
<p>
31-
Edit
32-
<code>components/HelloWorld.vue</code> to test hot module replacement.
33-
</p>
16+
<h1>Vue 3 + Netlify Forms</h1>
17+
18+
<form class="feedback-form">
19+
<div class="input-wrapper">
20+
<label for="name">Name</label>
21+
<input id="name" v-model="data.name" type="text" />
22+
</div>
23+
24+
<div class="input-wrapper">
25+
<label for="email">Email</label>
26+
<input id="email" v-model="data.email" type="email" />
27+
</div>
28+
29+
<div class="input-wrapper">
30+
<label for="message">Message</label>
31+
<textarea id="message" v-model="data.message"></textarea>
32+
</div>
33+
34+
<button type="submit" @click="submit">Submit</button>
35+
</form>
3436
</template>
3537

3638
<style scoped>
3739
a {
3840
color: #42b983;
3941
}
42+
43+
.feedback-form {
44+
max-width: 600px;
45+
margin: 0 auto;
46+
}
47+
48+
.input-wrapper {
49+
display: grid;
50+
grid-template-rows: auto 1fr;
51+
grid-row-gap: 5px;
52+
margin-bottom: 1rem;
53+
text-align: left;
54+
}
55+
56+
.input-wrapper:last-child {
57+
margin-bottom: 0;
58+
}
59+
60+
.input-wrapper input {
61+
padding: 10px;
62+
font-size: 1rem;
63+
}
64+
65+
.input-wrapper textarea {
66+
height: 100px;
67+
}
4068
</style>

0 commit comments

Comments
 (0)