Fix flicking while loading

This commit is contained in:
MD. Ariful Alam
2021-08-27 00:35:53 +06:00
parent 39d75d1e52
commit 19e158683d

View File

@@ -9,31 +9,39 @@ const AvatarCard = () => {
return ( return (
<div className="card shadow-lg compact bg-base-100"> <div className="card shadow-lg compact bg-base-100">
<div className="grid place-items-center py-8"> <div className="grid place-items-center py-8">
<div className="avatar opacity-90 fade-in"> {
<div className={`mb-8 rounded-full w-32 h-32${!loading ? ' ring ring-primary ring-offset-base-100 ring-offset-2' : ''}`}> loading ? (
{ <div className="avatar opacity-90">
loading ? ( <div className="mb-8 rounded-full w-32 h-32">
skeleton({ {
width: 'w-full', skeleton({
height: 'h-full', width: 'w-full',
shape: '', height: 'h-full',
}) shape: '',
) : ( })
<LazyImage }
src={profile.avatar ? profile.avatar : fallbackImage} </div>
alt={profile.name} </div>
placeholder={ ) : (
skeleton({ <div className="avatar opacity-90">
width: 'w-full', <div className="mb-8 rounded-full w-32 h-32 ring ring-primary ring-offset-base-100 ring-offset-2">
height: 'h-full', {
shape: '', <LazyImage
}) src={profile.avatar ? profile.avatar : fallbackImage}
} alt={profile.name}
/> placeholder={
) skeleton({
} width: 'w-full',
</div> height: 'h-full',
</div> shape: '',
})
}
/>
}
</div>
</div>
)
}
<div className="text-center mx-auto md:mx-8"> <div className="text-center mx-auto md:mx-8">
<h5 className="font-bold text-2xl"> <h5 className="font-bold text-2xl">
{ {