fix: better way to upload lead image

This commit is contained in:
Shariq Ansari 2023-11-06 16:23:44 +05:30
parent 475bf6469b
commit 545482b57e

View File

@ -59,26 +59,32 @@
:label="lead.data.first_name" :label="lead.data.first_name"
:image="lead.data.image" :image="lead.data.image"
/> />
<Dropdown <component
:options="[ :is="lead.data.image ? Dropdown : 'div'"
{ v-bind="
icon: 'upload', lead.data.image
label: lead.data.image ? 'Change photo' : 'Upload photo', ? {
onClick: openFileSelector, options: [
}, {
{ icon: 'upload',
icon: 'trash-2', label: lead.data.image
label: 'Remove photo', ? 'Change image'
onClick: () => { : 'Upload image',
lead.data.image = '' onClick: openFileSelector,
updateLead('image', '') },
}, {
}, icon: 'trash-2',
]" label: 'Remove image',
onClick: () => changeLeadImage(''),
},
],
}
: { onClick: openFileSelector }
"
class="!absolute bottom-0 left-0 right-0" class="!absolute bottom-0 left-0 right-0"
> >
<div <div
class="z-1 absolute bottom-0 left-0 right-0 flex h-11 cursor-pointer items-center justify-center rounded-b-full bg-black bg-opacity-40 pt-3 opacity-0 duration-300 ease-in-out group-hover:opacity-100" class="z-1 absolute bottom-0 left-0 right-0 flex h-13 cursor-pointer items-center justify-center rounded-b-full bg-black bg-opacity-40 pt-3 opacity-0 duration-300 ease-in-out group-hover:opacity-100"
style=" style="
-webkit-clip-path: inset(12px 0 0 0); -webkit-clip-path: inset(12px 0 0 0);
clip-path: inset(12px 0 0 0); clip-path: inset(12px 0 0 0);
@ -86,7 +92,7 @@
> >
<CameraIcon class="h-6 w-6 cursor-pointer text-white" /> <CameraIcon class="h-6 w-6 cursor-pointer text-white" />
</div> </div>
</Dropdown> </component>
</div> </div>
<div class="flex flex-col gap-2.5 truncate"> <div class="flex flex-col gap-2.5 truncate">
<Tooltip :text="lead.data.lead_name"> <Tooltip :text="lead.data.lead_name">