From 70cb660cd2f1a0f5f1aa543dcac8c6b3cd81afcc Mon Sep 17 00:00:00 2001 From: Felicio Mununga Date: Fri, 15 Dec 2023 14:22:31 +0100 Subject: [PATCH] update avatar initials (#515) * update avatar initials * Create itchy-steaks-leave.md --- .changeset/itchy-steaks-leave.md | 5 + .../components/src/avatar/avatar.stories.tsx | 338 +++++++++--------- packages/components/src/avatar/avatar.tsx | 13 +- 3 files changed, 192 insertions(+), 164 deletions(-) create mode 100644 .changeset/itchy-steaks-leave.md diff --git a/.changeset/itchy-steaks-leave.md b/.changeset/itchy-steaks-leave.md new file mode 100644 index 00000000..44753420 --- /dev/null +++ b/.changeset/itchy-steaks-leave.md @@ -0,0 +1,5 @@ +--- +"@status-im/components": patch +--- + +update avatar initials diff --git a/packages/components/src/avatar/avatar.stories.tsx b/packages/components/src/avatar/avatar.stories.tsx index ccfe15fa..628bd2e1 100644 --- a/packages/components/src/avatar/avatar.stories.tsx +++ b/packages/components/src/avatar/avatar.stories.tsx @@ -45,79 +45,161 @@ export const User: StoryObj = { render: args => ( - - - - - + + + + + + + + + + + + + + + @@ -127,95 +209,27 @@ export const User: StoryObj = { - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/components/src/avatar/avatar.tsx b/packages/components/src/avatar/avatar.tsx index b4c1752f..9f0ce8f7 100644 --- a/packages/components/src/avatar/avatar.tsx +++ b/packages/components/src/avatar/avatar.tsx @@ -216,7 +216,16 @@ const Avatar = (props: AvatarProps) => { color="$white-100" select={false} > - {props.name.slice(0, 2).toUpperCase()} + {props.name + .slice( + 0, + props.type === 'user' && + props.size < 28 && + (!props.indicator || props.indicator === 'none') + ? 1 + : 2 + ) + .toUpperCase()} )} @@ -267,7 +276,7 @@ const Avatar = (props: AvatarProps) => { color="$white-100" select={false} > - {props.name.slice(0, 2).toUpperCase()} + {props.name.slice(0, props.size < 24 ? 1 : 2).toUpperCase()} )