feat: add user image to ParticipantListEntry component
This commit is contained in:
parent
ea6bef9562
commit
24628a13f5
2 changed files with 8 additions and 4 deletions
|
@ -148,6 +148,7 @@ export default function ShowEvent() {
|
|||
<ParticipantListEntry
|
||||
key={user.user.id}
|
||||
participant={user.user.name}
|
||||
imageSrc={user.user.image}
|
||||
></ParticipantListEntry>
|
||||
))}
|
||||
</div>
|
||||
|
|
|
@ -6,19 +6,22 @@ import { useTheme } from 'next-themes';
|
|||
|
||||
type ParticipantListEntryProps = {
|
||||
participant: string;
|
||||
imageSrc?: string;
|
||||
imageSrc?: string | null;
|
||||
};
|
||||
|
||||
export default function ParticipantListEntry({
|
||||
participant,
|
||||
imageSrc,
|
||||
}: ParticipantListEntryProps) {
|
||||
const { resolvedTheme } = useTheme();
|
||||
|
||||
const iconSrc =
|
||||
const defaultImage =
|
||||
resolvedTheme === 'dark' ? user_default_dark : user_default_light;
|
||||
|
||||
const finalImageSrc = imageSrc ?? defaultImage;
|
||||
|
||||
return (
|
||||
<div className='flex items-center gap-2 py-1 ml-5'>
|
||||
<Image src={iconSrc} alt='Avatar' width={30} height={30} />
|
||||
<Image src={finalImageSrc} alt='Avatar' width={30} height={30} />
|
||||
<span>{participant}</span>
|
||||
</div>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue