Image First Change

This commit is contained in:
Flatlogic Bot 2025-08-19 19:54:22 +00:00
parent 74000da528
commit f1b098160d
3 changed files with 57 additions and 48 deletions

File diff suppressed because one or more lines are too long

View File

@ -64,6 +64,14 @@ const FormImagePicker = ({
const showFilename = !isRoundIcon && file; const showFilename = !isRoundIcon && file;
return ( return (
<div>
{file && (
<img
src={file.url || URL.createObjectURL(file)}
alt="Preview"
className="mb-4 max-h-48 object-contain"
/>
)}
<div className='flex items-stretch justify-start relative'> <div className='flex items-stretch justify-start relative'>
<label className='inline-flex'> <label className='inline-flex'>
<BaseButton <BaseButton
@ -97,6 +105,8 @@ const FormImagePicker = ({
</div> </div>
)} )}
</div> </div>
</div>
); );
}; };

View File

@ -91,6 +91,21 @@ const BottlesNew = () => {
onSubmit={(values) => handleSubmit(values)} onSubmit={(values) => handleSubmit(values)}
> >
<Form> <Form>
<FormField label='Picture'>
<Field
label='Picture'
color='info'
icon={mdiUpload}
path='bottles/picture'
name='picture'
id='picture'
accept='image/*'
capture
schema={{ size: undefined, formats: undefined }}
component={FormImagePicker}
></Field>
</FormField>
<FormField label='Name'> <FormField label='Name'>
<Field name='name' placeholder='Name' /> <Field name='name' placeholder='Name' />
</FormField> </FormField>
@ -169,23 +184,6 @@ const BottlesNew = () => {
<Field name='barcode' placeholder='Barcode' /> <Field name='barcode' placeholder='Barcode' />
</FormField> </FormField>
<FormField>
<Field
label='Picture'
color='info'
icon={mdiUpload}
path={'bottles/picture'}
name='picture'
id='picture'
accept='image/*'
capture
schema={{
size: undefined,
formats: undefined,
}}
component={FormImagePicker}
></Field>
</FormField>
<FormField label='Age'> <FormField label='Age'>
<Field type='number' name='age' placeholder='Age' /> <Field type='number' name='age' placeholder='Age' />