diff --git a/src/components/avatar.tsx b/src/components/avatar.tsx index 39588a8..4756022 100644 --- a/src/components/avatar.tsx +++ b/src/components/avatar.tsx @@ -2,7 +2,14 @@ import { Avatar as MantineAvatar, AvatarProps as MantineAvatarProps, Paper, + Modal, + Image, + Group, + Text, + ActionIcon, } from "@mantine/core"; +import { useState } from "react"; +import { XIcon } from "@phosphor-icons/react"; interface AvatarProps extends Omit { @@ -10,6 +17,7 @@ interface AvatarProps size?: number; radius?: string | number; withBorder?: boolean; + disableFullscreen?: boolean; } const Avatar = ({ @@ -17,26 +25,121 @@ const Avatar = ({ size = 35, radius = "100%", withBorder = true, + disableFullscreen = false, ...props }: AvatarProps) => { + const [isFullscreenOpen, setIsFullscreenOpen] = useState(false); + const hasImage = Boolean(props.src); + + const handleAvatarClick = () => { + if (hasImage && !disableFullscreen) { + setIsFullscreenOpen(true); + } + }; + return ( - - + { + if (hasImage && !disableFullscreen) { + e.currentTarget.style.transform = 'scale(1.02)'; + } + }} + onMouseLeave={(e) => { + e.currentTarget.style.transform = 'scale(1)'; + }} + onClick={handleAvatarClick} + > + + + + setIsFullscreenOpen(false)} + size="auto" + centered + withCloseButton={false} + overlayProps={{ + backgroundOpacity: 0.9, + blur: 2, + }} styles={{ - image: { - objectFit: "contain", + content: { + background: 'transparent', + border: 'none', + }, + body: { + padding: 0, }, }} - {...props} - /> - + > +
+ setIsFullscreenOpen(false)} + > + + + + {name} + + + + {name} + + +
+ + ); };