-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: rework Avatar, User and UserLabel components
- Loading branch information
Showing
114 changed files
with
786 additions
and
401 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
export const getAvatarDisplayText = (text: string) => { | ||
const words = text.split(/\s+/); | ||
const result = | ||
words.length > 1 ? [words[0][0], words[1][0]].filter(Boolean).join('') : text.slice(0, 2); | ||
import type {AvatarSize} from '../types/common'; | ||
|
||
return result.toUpperCase(); | ||
export const getAvatarDisplayText = (text: string, size: AvatarSize) => { | ||
if (size === '3xs') { | ||
return text[0].toUpperCase(); | ||
} | ||
|
||
const words = text.split(/[^a-zA-Z]+/); | ||
|
||
if (words.length <= 1) { | ||
return text.slice(0, 2).toUpperCase(); | ||
} | ||
|
||
return [words[0][0], words[1][0]].filter(Boolean).join('').toUpperCase(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file removed
BIN
-1.3 KB
.../Avatar.visual.test.tsx-snapshots/Avatar-render-story-Icon-1-chromium-linux.png
Binary file not shown.
Binary file removed
BIN
-1.21 KB
...__/Avatar.visual.test.tsx-snapshots/Avatar-render-story-Icon-1-webkit-linux.png
Binary file not shown.
Binary file added
BIN
+2.75 KB
...atar.visual.test.tsx-snapshots/Avatar-render-story-Icon-dark-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.99 KB
...Avatar.visual.test.tsx-snapshots/Avatar-render-story-Icon-dark-webkit-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.47 KB
...tar.visual.test.tsx-snapshots/Avatar-render-story-Icon-light-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.67 KB
...vatar.visual.test.tsx-snapshots/Avatar-render-story-Icon-light-webkit-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-2.28 KB
...Avatar.visual.test.tsx-snapshots/Avatar-render-story-Image-1-chromium-linux.png
Binary file not shown.
Binary file removed
BIN
-2 KB
..._/Avatar.visual.test.tsx-snapshots/Avatar-render-story-Image-1-webkit-linux.png
Binary file not shown.
Binary file added
BIN
+6.35 KB
...tar.visual.test.tsx-snapshots/Avatar-render-story-Image-dark-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.09 KB
...vatar.visual.test.tsx-snapshots/Avatar-render-story-Image-dark-webkit-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.84 KB
...ar.visual.test.tsx-snapshots/Avatar-render-story-Image-light-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.57 KB
...atar.visual.test.tsx-snapshots/Avatar-render-story-Image-light-webkit-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-2.28 KB
...isual.test.tsx-snapshots/Avatar-render-story-ImageFallback-1-chromium-linux.png
Binary file not shown.
Binary file added
BIN
+6.35 KB
...al.test.tsx-snapshots/Avatar-render-story-ImageFallback-dark-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.84 KB
...l.test.tsx-snapshots/Avatar-render-story-ImageFallback-light-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-110 KB
...tar.visual.test.tsx-snapshots/Avatar-render-story-Showcase-1-chromium-linux.png
Binary file not shown.
Binary file removed
BIN
-116 KB
...vatar.visual.test.tsx-snapshots/Avatar-render-story-Showcase-1-webkit-linux.png
Binary file not shown.
Binary file added
BIN
+264 KB
....visual.test.tsx-snapshots/Avatar-render-story-Showcase-dark-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+288 KB
...ar.visual.test.tsx-snapshots/Avatar-render-story-Showcase-dark-webkit-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+249 KB
...visual.test.tsx-snapshots/Avatar-render-story-Showcase-light-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+273 KB
...r.visual.test.tsx-snapshots/Avatar-render-story-Showcase-light-webkit-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-965 Bytes
.../Avatar.visual.test.tsx-snapshots/Avatar-render-story-Text-1-chromium-linux.png
Binary file not shown.
Binary file removed
BIN
-1.02 KB
...__/Avatar.visual.test.tsx-snapshots/Avatar-render-story-Text-1-webkit-linux.png
Binary file not shown.
Binary file added
BIN
+2.13 KB
...atar.visual.test.tsx-snapshots/Avatar-render-story-Text-dark-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.31 KB
...Avatar.visual.test.tsx-snapshots/Avatar-render-story-Text-dark-webkit-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.85 KB
...tar.visual.test.tsx-snapshots/Avatar-render-story-Text-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+1.99 KB
...vatar.visual.test.tsx-snapshots/Avatar-render-story-Text-light-webkit-linux.png
Oops, something went wrong.
Binary file removed
BIN
-1.28 KB
...visual.test.tsx-snapshots/Avatar-render-story-TextInitials-1-chromium-linux.png
Diff not rendered.
Binary file removed
BIN
-1.29 KB
...r.visual.test.tsx-snapshots/Avatar-render-story-TextInitials-1-webkit-linux.png
Diff not rendered.
Binary file added
BIN
+2.68 KB
...ual.test.tsx-snapshots/Avatar-render-story-TextInitials-dark-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+2.89 KB
...isual.test.tsx-snapshots/Avatar-render-story-TextInitials-dark-webkit-linux.png
Oops, something went wrong.
Binary file added
BIN
+2.42 KB
...al.test.tsx-snapshots/Avatar-render-story-TextInitials-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+2.59 KB
...sual.test.tsx-snapshots/Avatar-render-story-TextInitials-light-webkit-linux.png
Oops, something went wrong.
Binary file removed
BIN
-2.63 KB
...r.visual.test.tsx-snapshots/Avatar-render-story-WithBorder-1-chromium-linux.png
Diff not rendered.
Binary file removed
BIN
-2.34 KB
...tar.visual.test.tsx-snapshots/Avatar-render-story-WithBorder-1-webkit-linux.png
Diff not rendered.
Binary file added
BIN
+6.81 KB
...isual.test.tsx-snapshots/Avatar-render-story-WithBorder-dark-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+7.54 KB
....visual.test.tsx-snapshots/Avatar-render-story-WithBorder-dark-webkit-linux.png
Oops, something went wrong.
Binary file added
BIN
+6.52 KB
...sual.test.tsx-snapshots/Avatar-render-story-WithBorder-light-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+7.22 KB
...visual.test.tsx-snapshots/Avatar-render-story-WithBorder-light-webkit-linux.png
Oops, something went wrong.
Oops, something went wrong.