Re-init DB and scaffold all models

This commit is contained in:
Kurt Hutten
2020-11-02 07:02:11 +11:00
parent 55f9dfd6de
commit 86df1d501d
97 changed files with 3202 additions and 2122 deletions

View File

@@ -0,0 +1,99 @@
import {
Form,
FormError,
FieldError,
Label,
TextField,
Submit,
} from '@redwoodjs/forms'
const UserForm = (props) => {
const onSubmit = (data) => {
props.onSave(data, props?.user?.id)
}
return (
<div className="rw-form-wrapper">
<Form onSubmit={onSubmit} error={props.error}>
<FormError
error={props.error}
wrapperClassName="rw-form-error-wrapper"
titleClassName="rw-form-error-title"
listClassName="rw-form-error-list"
/>
<Label
name="userName"
className="rw-label"
errorClassName="rw-label rw-label-error"
>
User name
</Label>
<TextField
name="userName"
defaultValue={props.user?.userName}
className="rw-input"
errorClassName="rw-input rw-input-error"
validation={{ required: true }}
/>
<FieldError name="userName" className="rw-field-error" />
<Label
name="email"
className="rw-label"
errorClassName="rw-label rw-label-error"
>
Email
</Label>
<TextField
name="email"
defaultValue={props.user?.email}
className="rw-input"
errorClassName="rw-input rw-input-error"
validation={{ required: true }}
/>
<FieldError name="email" className="rw-field-error" />
<Label
name="image"
className="rw-label"
errorClassName="rw-label rw-label-error"
>
Image
</Label>
<TextField
name="image"
defaultValue={props.user?.image}
className="rw-input"
errorClassName="rw-input rw-input-error"
validation={{ required: true }}
/>
<FieldError name="image" className="rw-field-error" />
<Label
name="bio"
className="rw-label"
errorClassName="rw-label rw-label-error"
>
Bio
</Label>
<TextField
name="bio"
defaultValue={props.user?.bio}
className="rw-input"
errorClassName="rw-input rw-input-error"
validation={{ required: true }}
/>
<FieldError name="bio" className="rw-field-error" />
<div className="rw-button-group">
<Submit disabled={props.loading} className="rw-button rw-button-blue">
Save
</Submit>
</div>
</Form>
</div>
)
}
export default UserForm