Skip to content

Commit 744214c

Browse files
committed
fix: PublicProfile mobile styling
1 parent 0154e19 commit 744214c

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

app/server-components/Profile/PublicProfile.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { getBrandingPlatforms } from '@/lib/api/backend';
33
import { cachedGetENSName, getShortAddress } from '@/lib/utils';
44
import { EthAddress } from '@/typedefs/blockchain';
55
import { PublicProfileInfo } from '@/typedefs/general';
6+
import clsx from 'clsx';
67
import Link from 'next/link';
78
import { RiGlobalLine, RiLinkedinBoxFill, RiTwitterXLine } from 'react-icons/ri';
89
import ProfileImage from './ProfileImage';
@@ -32,13 +33,11 @@ export default async function PublicProfile({
3233
ownerEthAddr: EthAddress;
3334
publicProfileInfo?: PublicProfileInfo;
3435
}) {
35-
let ensName: string | undefined, brandingPlatforms: string[] = [];
36+
let ensName: string | undefined,
37+
brandingPlatforms: string[] = [];
3638

3739
try {
38-
[ensName, brandingPlatforms] = await Promise.all([
39-
cachedGetENSName(ownerEthAddr),
40-
getBrandingPlatforms(),
41-
]);
40+
[ensName, brandingPlatforms] = await Promise.all([cachedGetENSName(ownerEthAddr), getBrandingPlatforms()]);
4241
} catch (error) {
4342
console.error(error);
4443
return null;
@@ -53,8 +52,15 @@ export default async function PublicProfile({
5352
);
5453
}
5554

55+
const hasDescription: boolean = !!publicProfileInfo?.description && publicProfileInfo?.description !== '';
56+
const hasSocialLinks: boolean = !!publicProfileInfo?.links && Object.keys(publicProfileInfo?.links).length > 0;
57+
5658
return (
57-
<div className="flex items-start gap-3 md:items-center md:gap-4">
59+
<div
60+
className={clsx('flex items-center gap-3 md:items-center md:gap-4', {
61+
'!items-start': hasDescription || hasSocialLinks,
62+
})}
63+
>
5864
<div className="center-all relative h-[60px] w-[60px] min-w-[60px] overflow-hidden rounded-[37.5%] sm:h-[84px] sm:w-[84px] sm:min-w-[84px]">
5965
<ClientWrapper>
6066
<ProfileImage ownerEthAddr={ownerEthAddr} />
@@ -73,12 +79,12 @@ export default async function PublicProfile({
7379
)}
7480
</div>
7581

76-
{publicProfileInfo?.description && (
82+
{hasDescription && (
7783
<div className="font-medium leading-5 text-slate-500">{publicProfileInfo?.description}</div>
7884
)}
7985
</div>
8086

81-
{!!publicProfileInfo?.links && Object.keys(publicProfileInfo?.links).length > 0 && (
87+
{hasSocialLinks && (
8288
<div className="row gap-2">
8389
{brandingPlatforms.map((platform) => {
8490
const link = publicProfileInfo?.links?.[platform];

0 commit comments

Comments
 (0)