Forced merge: merge ai-dev into master
This commit is contained in:
commit
87b08b420c
File diff suppressed because one or more lines are too long
@ -64,49 +64,39 @@ const FormImagePicker = ({
|
|||||||
const showFilename = !isRoundIcon && file;
|
const showFilename = !isRoundIcon && file;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div className='flex items-stretch justify-start relative'>
|
||||||
{file && (
|
<label className='inline-flex'>
|
||||||
<img
|
<BaseButton
|
||||||
src={file.url || URL.createObjectURL(file)}
|
className={`${isRoundIcon ? 'w-12 h-12' : ''} ${
|
||||||
alt="Preview"
|
showFilename ? 'rounded-r-none' : ''
|
||||||
className="mb-4 max-h-48 object-contain"
|
}`}
|
||||||
|
iconSize={isRoundIcon ? 24 : undefined}
|
||||||
|
label={isRoundIcon ? null : label}
|
||||||
|
icon={loading ? mdiReload : icon}
|
||||||
|
iconClassName={loading && 'animate-spin'}
|
||||||
|
color={color}
|
||||||
|
roundedFull={isRoundIcon}
|
||||||
|
asAnchor
|
||||||
/>
|
/>
|
||||||
|
<input
|
||||||
|
type='file'
|
||||||
|
className='absolute top-0 left-0 w-full h-full opacity-0 outline-none cursor-pointer -z-1'
|
||||||
|
onChange={handleFileChange}
|
||||||
|
accept={accept}
|
||||||
|
capture
|
||||||
|
disabled={loading}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
{showFilename && !loading && (
|
||||||
|
<div
|
||||||
|
className={` ${cornersRight} px-4 py-2 max-w-full flex-grow-0 overflow-x-hidden ${bgColor} dark:bg-slate-800 border-gray-200 dark:border-slate-700 border `}
|
||||||
|
>
|
||||||
|
<span className='text-ellipsis max-w-full line-clamp-1'>
|
||||||
|
{file.name}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className='flex items-stretch justify-start relative'>
|
|
||||||
<label className='inline-flex'>
|
|
||||||
<BaseButton
|
|
||||||
className={`${isRoundIcon ? 'w-12 h-12' : ''} ${
|
|
||||||
showFilename ? 'rounded-r-none' : ''
|
|
||||||
}`}
|
|
||||||
iconSize={isRoundIcon ? 24 : undefined}
|
|
||||||
label={isRoundIcon ? null : label}
|
|
||||||
icon={loading ? mdiReload : icon}
|
|
||||||
iconClassName={loading && 'animate-spin'}
|
|
||||||
color={color}
|
|
||||||
roundedFull={isRoundIcon}
|
|
||||||
asAnchor
|
|
||||||
/>
|
|
||||||
<input
|
|
||||||
type='file'
|
|
||||||
className='absolute top-0 left-0 w-full h-full opacity-0 outline-none cursor-pointer -z-1'
|
|
||||||
onChange={handleFileChange}
|
|
||||||
accept={accept}
|
|
||||||
capture
|
|
||||||
disabled={loading}
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
{showFilename && !loading && (
|
|
||||||
<div
|
|
||||||
className={` ${cornersRight} px-4 py-2 max-w-full flex-grow-0 overflow-x-hidden ${bgColor} dark:bg-slate-800 border-gray-200 dark:border-slate-700 border `}
|
|
||||||
>
|
|
||||||
<span className='text-ellipsis max-w-full line-clamp-1'>
|
|
||||||
{file.name}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -91,21 +91,6 @@ 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>
|
||||||
@ -184,6 +169,23 @@ 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' />
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user