Files
supabase/apps/studio/components/ui/ProfileImage.tsx
T
Ivan VasilovandJoshen Lim 9fa96977be chore: Minor prettier fixes (#43849)
This PR fixes some prettier issues:
- Bump and unify all prettier versions to 3.7.3 across teh whole repo
- Bump the SQL prettier plugin
- When running `test:prettier`, check `mdx` files also
- Run the new prettier format on all files

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-03-17 11:17:42 +01:00

36 lines
905 B
TypeScript

import Image from 'next/image'
import { ReactNode, useState } from 'react'
import { User } from 'icons'
import { cn } from 'ui'
interface ProfileImageProps {
alt?: string
src?: string
placeholder?: ReactNode
className?: string
}
export const ProfileImage = ({ alt, src, placeholder, className }: ProfileImageProps) => {
const [hasInvalidImg, setHasInvalidImg] = useState(false)
return !!src && !hasInvalidImg ? (
<Image
alt={alt ?? ''}
src={src}
width="24"
height="24"
className={cn('aspect-square bg-foreground rounded-full object-cover', className)}
onError={() => setHasInvalidImg(true)}
/>
) : (
(placeholder ?? (
<figure
className={cn('bg-foreground rounded-full flex items-center justify-center', className)}
>
<User size={18} strokeWidth={1.5} className="text-background" />
</figure>
))
)
}