chore: hide delete action when avatar is none (#24512)

This commit is contained in:
crazywoola 2025-08-25 19:25:55 -07:00 • committed by GitHub
commit aa71f88e1b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 22 additions and 8 deletions

View file

@ -8,6 +8,7 @@ export type AvatarProps = {
size?: number
className?: string
textClassName?: string
onError?: (x: boolean) => void
}
const Avatar = ({
name,
@ -15,6 +16,7 @@ const Avatar = ({
size = 30,
className,
textClassName,
onError,
}: AvatarProps) => {
const avatarClassName = 'shrink-0 flex items-center rounded-full bg-primary-600'
const style = { width: `${size}px`, height: `${size}px`, fontSize: `${size}px`, lineHeight: `${size}px` }
@ -22,6 +24,7 @@ const Avatar = ({
const handleError = () => {
setImgError(true)
onError?.(true)
}
if (avatar && !imgError) {
@ -32,6 +35,7 @@ const Avatar = ({
alt={name}
src={avatar}
onError={handleError}
onLoad={() => onError?.(false)}
/>
)
}