mirror of
https://github.com/irislib/iris-messenger.git
synced 2024-10-18 06:03:22 +00:00
reduce profile layout shift by showing banner placeholder
This commit is contained in:
parent
0ecd07b4ab
commit
aae6b69347
@ -10,7 +10,9 @@ export const useProfile = (pub: string) => {
|
||||
if (!pub) return;
|
||||
|
||||
return SocialNetwork.getProfile(pub, (p) => {
|
||||
p && setProfile(p);
|
||||
if (p && p.created_at !== profile.created_at) {
|
||||
setProfile(p);
|
||||
}
|
||||
});
|
||||
}, [pub]);
|
||||
|
||||
|
@ -134,15 +134,18 @@ function Profile(props) {
|
||||
|
||||
return (
|
||||
<View>
|
||||
<Show when={banner && !blocked}>
|
||||
<div
|
||||
className="mb-4 h-48 bg-cover bg-center cursor-pointer"
|
||||
style={{ backgroundImage: `url(${banner})` }}
|
||||
onClick={() => setBannerModalOpen(true)}
|
||||
></div>
|
||||
<Show when={bannerModalOpen}>
|
||||
<SimpleImageModal imageUrl={profile.banner} onClose={() => setBannerModalOpen(false)} />
|
||||
</Show>
|
||||
<div
|
||||
className="mb-4 h-48 bg-cover bg-center cursor-pointer"
|
||||
style={{
|
||||
backgroundImage:
|
||||
banner && !blocked
|
||||
? `url(${banner})`
|
||||
: 'linear-gradient(120deg, #010101 0%, #1f0f26 50%, #010101 100%)',
|
||||
}}
|
||||
onClick={() => banner && !blocked && setBannerModalOpen(true)}
|
||||
></div>
|
||||
<Show when={bannerModalOpen}>
|
||||
<SimpleImageModal imageUrl={profile.banner} onClose={() => setBannerModalOpen(false)} />
|
||||
</Show>
|
||||
<div>
|
||||
<ProfileHelmet
|
||||
|
Loading…
Reference in New Issue
Block a user