Skip to content

Commit 344b940

Browse files
committed
Create reuseable text area
1 parent 623ed48 commit 344b940

File tree

4 files changed

+55
-39
lines changed

4 files changed

+55
-39
lines changed

src/components/HireMeModal.vue

+8-19
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
import feather from 'feather-icons';
33
import Button from './reusable/Button.vue';
44
import FormInput from './reusable/FormInput.vue';
5+
import FormTextarea from './reusable/FormTextarea.vue';
56
export default {
67
props: ['showModal', 'modal', 'categories'],
7-
components: { Button, FormInput },
8+
components: { Button, FormInput, FormTextarea },
89
data() {
910
return {};
1011
},
@@ -67,7 +68,7 @@ export default {
6768
inputType="email"
6869
/>
6970

70-
<div class="mt-6">
71+
<div class="mt-6 mb-4">
7172
<label
7273
class="block mb-2 text-lg text-primary-dark dark:text-primary-light"
7374
for="project"
@@ -91,24 +92,12 @@ export default {
9192
</select>
9293
</div>
9394

94-
<div class="mt-6">
95-
<label
96-
class="block mb-2 text-lg text-primary-dark dark:text-primary-light"
97-
for="details"
98-
>Details</label
99-
>
100-
<textarea
101-
class="w-full px-5 py-2 border-1 border-gray-200 dark:border-secondary-dark rounded-md text-md bg-secondary-light dark:bg-ternary-dark text-primary-dark dark:text-ternary-light"
102-
id="details"
103-
name="details"
104-
cols="14"
105-
rows="6"
106-
aria-label="Details"
107-
placeholder="Project description"
108-
></textarea>
109-
</div>
95+
<FormTextarea
96+
label="Details"
97+
textareaIdentifier="details"
98+
/>
11099

111-
<div class="mt-6 pb-4 sm:pb-1">
100+
<div class="mt-7 pb-4 sm:pb-1">
112101
<Button
113102
title="Send Request"
114103
class="px-4 sm:px-6 py-2 sm:py-2.5 text-white bg-indigo-500 hover:bg-indigo-600 rounded-md focus:ring-1 focus:ring-indigo-900 duration-500"

src/components/contact/ContactForm.vue

+3-17
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<script>
22
import Button from '../reusable/Button.vue';
33
import FormInput from '../reusable/FormInput.vue';
4-
export default { components: { Button, FormInput } };
4+
import FormTextarea from '../reusable/FormTextarea.vue';
5+
export default { components: { Button, FormInput, FormTextarea } };
56
</script>
67

78
<template>
@@ -22,22 +23,7 @@ export default { components: { Button, FormInput } };
2223
inputType="email"
2324
/>
2425
<FormInput label="Subject" inputIdentifier="subject" />
25-
26-
<div>
27-
<label
28-
class="block text-lg text-primary-dark dark:text-primary-light mb-2"
29-
for="message"
30-
>Message</label
31-
>
32-
<textarea
33-
class="w-full px-5 py-2 border border-gray-300 dark:border-primary-dark border-opacity-50 text-primary-dark dark:text-secondary-light bg-ternary-light dark:bg-ternary-dark rounded-md shadow-sm text-md"
34-
id="message"
35-
name="message"
36-
cols="14"
37-
rows="6"
38-
aria-label="Message"
39-
></textarea>
40-
</div>
26+
<FormTextarea label="Message" textareaIdentifier="message" />
4127

4228
<div>
4329
<Button

src/components/reusable/FormInput.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ export default {
3434
:name="inputIdentifier"
3535
:placeholder="label"
3636
:aria-label="inputIdentifier"
37-
required
38-
v-bind="$attrs"
3937
:value="val"
40-
@input="$emit('update:val', $event.target.value)"
4138
:type="inputType"
39+
v-bind="$attrs"
40+
@input="$emit('update:val', $event.target.value)"
41+
required
4242
/>
4343
</div>
4444
</template>
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<script>
2+
export default {
3+
props: {
4+
label: {
5+
type: String,
6+
default: '',
7+
},
8+
textareaIdentifier: {
9+
type: String,
10+
default: '',
11+
},
12+
val: {
13+
type: [String, Number],
14+
default: '',
15+
},
16+
},
17+
};
18+
</script>
19+
20+
<template>
21+
<div>
22+
<label
23+
class="block text-lg text-primary-dark dark:text-primary-light mb-2"
24+
:for="textareaIdentifier"
25+
>{{ label }}</label
26+
>
27+
<textarea
28+
class="w-full px-5 py-2 border border-gray-300 dark:border-primary-dark border-opacity-50 text-primary-dark dark:text-secondary-light bg-ternary-light dark:bg-ternary-dark rounded-md shadow-sm text-md"
29+
:id="textareaIdentifier"
30+
:name="textareaIdentifier"
31+
:aria-label="textareaIdentifier"
32+
:placeholder="label"
33+
v-bind="$attrs"
34+
@input="$emit('update:val', $event.target.value)"
35+
cols="14"
36+
rows="6"
37+
></textarea>
38+
</div>
39+
</template>
40+
41+
<style lang="scss" scoped></style>

0 commit comments

Comments
 (0)