@@ -50,8 +50,15 @@ export const Form: FunctionComponent<Props> = ({ {{{lc}}} }) => {
50
50
} ;
51
51
52
52
return (
53
- < div >
54
- < h1 > { { { { lc} } } ? `Edit {{{ucf}}} ${ { { ~ lc } }['@id']}` : `Create {{{ucf}}}` } </ h1 >
53
+ < div className = "container mx-auto px-4 max-w-2xl mt-4" >
54
+ < Link href = "/{{{lc}}}s" >
55
+ < a className = "text-sm text-cyan-500 font-bold hover:text-cyan-700" >
56
+ { `< Back to list` }
57
+ </ a >
58
+ </ Link >
59
+ < h1 className = "text-3xl my-2" >
60
+ { { { { lc} } } ? `Edit {{{ucf}}} ${ { { ~ lc } }['@id']}` : `Create {{{ucf}}}` }
61
+ </ h1 >
55
62
< Formik
56
63
initialValues = {
57
64
{ { lc} } ?
@@ -110,15 +117,15 @@ export const Form: FunctionComponent<Props> = ({ {{{lc}}} }) => {
110
117
handleSubmit ,
111
118
isSubmitting ,
112
119
} ) => (
113
- < form onSubmit = { handleSubmit} >
120
+ < form className = "shadow-md p-4" onSubmit = { handleSubmit} >
114
121
{ { #each formFields} }
115
- < div className = "form-group " >
122
+ < div className = "mb-2 " >
116
123
{ { #if isRelations} }
117
- < div className = "form-control-label " > { { name} } </ div >
124
+ < div className = "text-gray-700 block text-sm font-bold " > { { name} } </ div >
118
125
< FieldArray
119
126
name = "{{name}}"
120
127
render = { ( arrayHelpers ) => (
121
- < div id = "{{../lc}}_{{name}}" >
128
+ < div className = "mb-2" id = "{{../lc}}_{{name}}" >
122
129
{ values . { { name } } && values . { { name} } .length > 0 ? (
123
130
values . { { name} } .map((item: any, index: number) => (
124
131
< div key = { index } >
@@ -146,7 +153,7 @@ export const Form: FunctionComponent<Props> = ({ {{{lc}}} }) => {
146
153
) }
147
154
/>
148
155
{ { else} }
149
- < label className = "form-control-label " htmlFor = "{{../lc}}_{{name}}" > { { name} } </ label >
156
+ < label className = "text-gray-700 block text-sm font-bold " htmlFor = "{{../lc}}_{{name}}" > { { name} } </ label >
150
157
< input
151
158
name = "{{name}}"
152
159
id = "{{../lc}}_{{name}}"
@@ -160,13 +167,13 @@ export const Form: FunctionComponent<Props> = ({ {{{lc}}} }) => {
160
167
{ { #if step} } step = "{{{step}}}" { { / i f } }
161
168
placeholder = "{{{description}}}"
162
169
{ { #if required} } required = { true } { { / i f } }
163
- className = { `form-control ${ errors . { { name } } && touched.{{name}} ? ' is-invalid ' : ''}` }
170
+ className = { `mt-1 block w-full ${ errors . { { name } } && touched.{{name}} ? 'border-red-500 ' : ''}` }
164
171
aria-invalid = { errors . { { name } } && touched . { { name~ } } ? 'true ' : undefined }
165
172
onChange = { handleChange }
166
173
onBlur = { handleBlur }
167
174
/>
168
175
< ErrorMessage
169
- className = "invalid-feedback "
176
+ className = "text-xs text-red-500 pt-1 "
170
177
component = "div"
171
178
name = "{{name}}"
172
179
/>
@@ -175,8 +182,8 @@ export const Form: FunctionComponent<Props> = ({ {{{lc}}} }) => {
175
182
{ { / e a c h } }
176
183
{ status && status . msg && (
177
184
< div
178
- className = { `alert ${
179
- status . isValid ? "alert-success " : "alert-danger "
185
+ className = { `border px-4 py-3 my-4 rounded ${
186
+ status . isValid ? "text-cyan-700 border-cyan-500 bg-cyan-200/50 " : "text-red-700 border-red-400 bg-red-100 "
180
187
} `}
181
188
role = "alert"
182
189
>
@@ -185,22 +192,21 @@ export const Form: FunctionComponent<Props> = ({ {{{lc}}} }) => {
185
192
) }
186
193
< button
187
194
type = "submit"
188
- className = "btn btn-success "
195
+ className = "inline-block mt-2 bg-cyan-500 hover:bg-cyan-700 text-sm text-white font-bold py-2 px-4 rounded "
189
196
disabled = { isSubmitting }
190
197
>
191
198
Submit
192
199
</ button >
193
200
</ form >
194
201
) }
195
202
< / Formik >
196
- < Link href = "/{{{lc}}}s" >
197
- < a className = "btn btn-primary" > Back to list</ a >
198
- < / L i n k >
203
+ < div className = "flex space-x-2 mt-4 justify-end" >
199
204
{ { { { lc} } } && (
200
- < button className = "btn btn-danger " onClick = { handleDelete } >
201
- < a > Delete</ a >
205
+ < button className = "inline-block mt-2 border-2 border-red-400 hover:border-red-700 hover:text-red-700 text-sm text-red-400 font-bold py-2 px-4 rounded " onClick = { handleDelete } >
206
+ Delete
202
207
</ button >
203
208
) }
209
+ < / div >
204
210
</div >
205
211
) ;
206
212
} ;
0 commit comments