import { FC } from 'react'; import Image from 'next/image'; import { Dialog, DialogContent, DialogHeader, DialogTrigger } from './ui/dialog'; import { cn } from '@/lib/utils'; import { DialogDescription, DialogTitle } from '@radix-ui/react-dialog'; type Props = { avatar: string className?: string, isPresence?: boolean sizes?: string; quality?: number }; const ViewAvatarNextImage: FC = ({ avatar, className, isPresence, quality = 65, sizes = "(max-width: 640px) 36px, 40px" }) => { return ( <> {avatar ? {/* avatar */}
avatar
Profile Description of profile avatar {/* avatar */} {/* 2. Logic Switch for Image Mode */} {isPresence ? ( // MODE A: Presence (Natural Aspect Ratio) // We use width=0 height=0 + sizes=100vw to emulate "width: 100%, height: auto" avatar ) : ( // MODE B: Default Profile (Fixed Box with Crop) // We use fill to cover the specific 500x500 box
avatar
)}
:
avatar
} ); } export const Avatar: FC = ({ avatar, className, sizes = "(max-width: 640px) 36px, 40px" }) => { return ( <> {avatar ? // avatar
avatar
: avatar } ); } export default ViewAvatarNextImage;