-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFormComponent.jsx
94 lines (87 loc) · 4.88 KB
/
FormComponent.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import {people} from "./TailwindComponent";
export default function FormComponent() {
return (
<>
<form data-testid="form" className="space-y-6" action="#" method="POST">
<div className="bg-white px-4 py-5 shadow sm:rounded-lg sm:p-6">
<div className="md:grid md:grid-cols-3 md:gap-6">
<div className="md:col-span-1">
<h3 className="text-base font-semibold leading-6 text-gray-900">Personal Information</h3>
</div>
<div className="mt-5 md:col-span-2 md:mt-0">
<div className="grid grid-cols-6 gap-6">
<div className="col-span-6 sm:col-span-3">
<label htmlFor="first-name" className="block text-sm font-medium text-gray-700">
First name
</label>
<input
type="text"
name="first-name"
id="first-name"
className="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"
defaultValue={people[0].name.split(" ")[0]}
/>
</div>
<div className="col-span-6 sm:col-span-3">
<label htmlFor="last-name" className="block text-sm font-medium text-gray-700">
Last name
</label>
<input
type="text"
name="last-name"
id="last-name"
className="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"
defaultValue={people[0].name.split(" ")[1]}
/>
</div>
<div className="col-span-6 sm:col-span-4">
<label htmlFor="email-address" className="block text-sm font-medium text-gray-700">
Email address
</label>
<input
type="text"
name="email-address"
id="email-address"
className="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"
defaultValue={people[0].email}
/>
</div>
<div className="col-span-6 sm:col-span-3">
<label htmlFor="title" className="block text-sm font-medium text-gray-700">
Title
</label>
<input
id="title"
name="title"
className="mt-1 block w-full rounded-md border border-gray-300 bg-white py-2 px-3 shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-indigo-500 sm:text-sm"
defaultValue={people[0].title}
/>
</div>
<div className="col-span-6">
<label htmlFor="Role" className="block text-sm font-medium text-gray-700">
Role
</label>
<input
type="text"
name="role"
id="role"
className="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"
defaultValue={people[0].role}
/>
</div>
</div>
</div>
</div>
</div>
</form>
<div className="flex justify-end py-5">
<button
onClick={()=> {alert("you clicked")}}
className="ml-3 inline-flex justify-center rounded-md border border-transparent bg-indigo-600 py-2 px-4 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2"
>
Save
</button>
</div>
</>
)
}