From 0bace50fcac775e7214eab01c96f7fea90d48e8c Mon Sep 17 00:00:00 2001 From: shadcn Date: Fri, 23 Dec 2022 20:35:05 +0400 Subject: [PATCH] fix: user avatar fallback image --- components/dashboard/user-avatar.tsx | 13 ++++++++----- ui/avatar.tsx | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/components/dashboard/user-avatar.tsx b/components/dashboard/user-avatar.tsx index d97f0eb..7da2822 100644 --- a/components/dashboard/user-avatar.tsx +++ b/components/dashboard/user-avatar.tsx @@ -11,11 +11,14 @@ interface UserAvatarProps extends AvatarProps { export function UserAvatar({ user, ...props }: UserAvatarProps) { return ( - - - {user.name} - - + {user.image ? ( + + ) : ( + + {user.name} + + + )} ) } diff --git a/ui/avatar.tsx b/ui/avatar.tsx index e9ab4b7..f7c15fa 100644 --- a/ui/avatar.tsx +++ b/ui/avatar.tsx @@ -1,7 +1,7 @@ +import Image, { ImageProps } from "next/image" import * as AvatarPrimitive from "@radix-ui/react-avatar" import { cn } from "@/lib/utils" -import Image, { ImageProps } from "next/image" type AvatarProps = AvatarPrimitive.AvatarProps @@ -32,7 +32,7 @@ Avatar.Image = function AvatarImage({ return (