-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: rework user components and add 3xs size
- Loading branch information
Showing
33 changed files
with
327 additions
and
248 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
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 modified
BIN
-3.81 KB
(97%)
...tar.visual.test.tsx-snapshots/Avatar-render-story-Showcase-1-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 modified
BIN
+6.77 KB
(110%)
...vatar.visual.test.tsx-snapshots/Avatar-render-story-Showcase-1-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.
Oops, something went wrong.