|
| 1 | +import Image from 'next/image'; |
| 2 | +import Link from 'next/link'; |
| 3 | +import { UserProfile } from '@/types/profile'; |
| 4 | +import { BoundlessButton } from '@/components/buttons'; |
| 5 | +import { BellPlus } from 'lucide-react'; |
| 6 | +import { ProfileSocialLinks } from '@/lib/config'; |
| 7 | + |
| 8 | +interface ProfileHeaderProps { |
| 9 | + profile: UserProfile; |
| 10 | +} |
| 11 | + |
| 12 | +export default function ProfileHeader({ profile }: ProfileHeaderProps) { |
| 13 | + return ( |
| 14 | + <main className='flex flex-col gap-6'> |
| 15 | + <header className='flex items-end gap-4'> |
| 16 | + <div className='relative size-[150px] overflow-hidden rounded-full bg-red-500'> |
| 17 | + <Image |
| 18 | + src={profile.avatarUrl} |
| 19 | + alt={`${profile.displayName} avatar`} |
| 20 | + layout='fill' |
| 21 | + objectFit='cover' |
| 22 | + /> |
| 23 | + </div> |
| 24 | + <div className='flex flex-col gap-3 py-3'> |
| 25 | + <h3 className='text-2xl font-medium'>{profile.displayName}</h3> |
| 26 | + <p className='text-base font-normal'>@{profile.username}</p> |
| 27 | + </div> |
| 28 | + </header> |
| 29 | + <p className='text-base font-normal'>{profile.bio}</p> |
| 30 | + <div className='flex items-center space-x-4'> |
| 31 | + {Object.entries(ProfileSocialLinks).map(([name, href], index) => ( |
| 32 | + <div key={name} className='flex items-center'> |
| 33 | + <Link |
| 34 | + href={href} |
| 35 | + className='rounded transition-opacity hover:opacity-80 focus:ring-2 focus:ring-white/50 focus:outline-none' |
| 36 | + target='_blank' |
| 37 | + rel='noopener noreferrer' |
| 38 | + aria-label={`Follow us on ${name}`} |
| 39 | + > |
| 40 | + <Image |
| 41 | + src={`/footer/${name}.svg`} |
| 42 | + alt={`${name} icon`} |
| 43 | + width={24} |
| 44 | + height={24} |
| 45 | + className='h-6 w-6' |
| 46 | + /> |
| 47 | + </Link> |
| 48 | + {index < Object.keys(ProfileSocialLinks).length - 1 && ( |
| 49 | + <div className='ml-4 h-6 w-0.5 bg-[#2B2B2B]' aria-hidden='true' /> |
| 50 | + )} |
| 51 | + </div> |
| 52 | + ))} |
| 53 | + </div> |
| 54 | + <div className='flex gap-4'> |
| 55 | + <BoundlessButton> |
| 56 | + Follow <BellPlus /> |
| 57 | + </BoundlessButton> |
| 58 | + <BoundlessButton variant='outline'> |
| 59 | + share{' '} |
| 60 | + <Image src='/share.svg' alt='Share icon' width={16} height={16} /> |
| 61 | + </BoundlessButton> |
| 62 | + </div> |
| 63 | + </main> |
| 64 | + ); |
| 65 | +} |
0 commit comments