Files
conve-x/src/components/UserProfile.tsx
T

44 lines
1.5 KiB
TypeScript
Raw Normal View History

import { UserDto } from '@/app/types';
2023-09-11 00:40:14 -05:00
import Image from 'next/image';
import { AiFillCalendar } from 'react-icons/ai';
2023-09-11 13:49:13 -05:00
export default function UserProfile({ user }: { user: UserDto }) {
const username = user.clerkUsername ?? user._id;
2023-09-11 00:40:14 -05:00
const userCreatedDate = new Date(user._creationTime);
const monthJoined = userCreatedDate.toLocaleString(undefined, {
month: 'short',
});
const yearJoined = userCreatedDate.getFullYear();
return (
<div className='w-full'>
2023-09-12 23:12:12 -05:00
<div className='shadow-md bg-gradient-to-r from-violet-600 via-violet-600 to-indigo-600 rounded-t-md pt-20 px-5'>
2023-09-11 00:40:14 -05:00
<div className='flex items-center gap-4 -mb-[25px]'>
2023-09-12 23:12:12 -05:00
<div className='flex-shrink-0'>
2023-09-11 00:40:14 -05:00
<Image
alt='user profile image'
src={user.clerkImageUrl}
2023-09-11 00:40:14 -05:00
width={100}
height={100}
className='rounded-full object-cover border-4 border-primary-accent'
/>
</div>
2023-09-12 23:12:12 -05:00
<div className='flex flex-col flex-1 min-w-0 text-white'>
<h1
className='font-bold overflow-hidden text-ellipsis'
title={username}
>
{username}
</h1>
2023-09-11 00:40:14 -05:00
<div className='flex gap-2 items-center text-sm'>
<AiFillCalendar className='w-4 h-4' />
{`Joined ${monthJoined} ${yearJoined}`}
</div>
</div>
</div>
</div>
<div className='h-[50px] bg-white dark:bg-primary-gray pl-5 pr-40 border border-gray-600 border-b-0'></div>
2023-09-11 00:40:14 -05:00
</div>
);
}