@@ -50,8 +50,15 @@ export const Form: FunctionComponent<Props> = ({ {{{lc}}} }) => {
5050 } ;
5151
5252 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 >
5562 < Formik
5663 initialValues = {
5764 { { lc} } ?
@@ -110,15 +117,15 @@ export const Form: FunctionComponent<Props> = ({ {{{lc}}} }) => {
110117 handleSubmit ,
111118 isSubmitting ,
112119 } ) => (
113- < form onSubmit = { handleSubmit} >
120+ < form className = "shadow-md p-4" onSubmit = { handleSubmit} >
114121 { { #each formFields} }
115- < div className = "form-group " >
122+ < div className = "mb-2 " >
116123 { { #if isRelations} }
117- < div className = "form-control-label " > { { name} } </ div >
124+ < div className = "text-gray-700 block text-sm font-bold " > { { name} } </ div >
118125 < FieldArray
119126 name = "{{name}}"
120127 render = { ( arrayHelpers ) => (
121- < div id = "{{../lc}}_{{name}}" >
128+ < div className = "mb-2" id = "{{../lc}}_{{name}}" >
122129 { values . { { name } } && values . { { name} } .length > 0 ? (
123130 values . { { name} } .map((item: any, index: number) => (
124131 < div key = { index } >
@@ -146,7 +153,7 @@ export const Form: FunctionComponent<Props> = ({ {{{lc}}} }) => {
146153 ) }
147154 />
148155 { { 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 >
150157 < input
151158 name = "{{name}}"
152159 id = "{{../lc}}_{{name}}"
@@ -160,13 +167,13 @@ export const Form: FunctionComponent<Props> = ({ {{{lc}}} }) => {
160167 { { #if step} } step = "{{{step}}}" { { / i f } }
161168 placeholder = "{{{description}}}"
162169 { { #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 ' : ''}` }
164171 aria-invalid = { errors . { { name } } && touched . { { name~ } } ? 'true ' : undefined }
165172 onChange = { handleChange }
166173 onBlur = { handleBlur }
167174 />
168175 < ErrorMessage
169- className = "invalid-feedback "
176+ className = "text-xs text-red-500 pt-1 "
170177 component = "div"
171178 name = "{{name}}"
172179 />
@@ -175,8 +182,8 @@ export const Form: FunctionComponent<Props> = ({ {{{lc}}} }) => {
175182 { { / e a c h } }
176183 { status && status . msg && (
177184 < 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 "
180187 } `}
181188 role = "alert"
182189 >
@@ -185,22 +192,21 @@ export const Form: FunctionComponent<Props> = ({ {{{lc}}} }) => {
185192 ) }
186193 < button
187194 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 "
189196 disabled = { isSubmitting }
190197 >
191198 Submit
192199 </ button >
193200 </ form >
194201 ) }
195202 < / 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" >
199204 { { { { 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
202207 </ button >
203208 ) }
209+ < / div >
204210 </div >
205211 ) ;
206212} ;
0 commit comments