From 4b7d54730c2716c02720108a6a1c2d4f5214277c Mon Sep 17 00:00:00 2001 From: canisminor1990 Date: Mon, 24 Jul 2023 15:57:00 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(avatar):=20Add=20default=20val?= =?UTF-8?q?ues=20for=20background=20prop=20and=20modify=20size=20of=20Flue?= =?UTF-8?q?ntEmoji=20component?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit introduces new features to the Avatar component. Default values are now added for the background prop, providing a fallback if not specified. The size of the FluentEmoji component is now modified based on the size prop. Changes Made: - Added default values for the background prop in the Avatar component - Modified the size of the FluentEmoji component based on the size prop --- src/Avatar/index.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Avatar/index.tsx b/src/Avatar/index.tsx index 54815484..9c2be5ab 100644 --- a/src/Avatar/index.tsx +++ b/src/Avatar/index.tsx @@ -32,7 +32,15 @@ export interface AvatarProps extends AntAvatarProps { } const Avatar = memo( - ({ className, avatar, title, size = 40, shape = 'circle', background, ...props }) => { + ({ + className, + avatar, + title, + size = 40, + shape = 'circle', + background = 'rgba(0,0,0,0)', + ...props + }) => { const isImage = Boolean( avatar && ['/', 'http', 'data:'].some((index) => avatar.startsWith(index)), ); @@ -52,7 +60,7 @@ const Avatar = memo( /> ) : ( - {emoji ? : text?.toUpperCase().slice(0, 2)} + {emoji ? : text?.toUpperCase().slice(0, 2)} ); },