storybook and template fixes

This commit is contained in:
41666 2020-12-03 11:32:09 -05:00
parent 7371b5e490
commit 0e2c981560
11 changed files with 69 additions and 30 deletions

View file

@ -1,10 +1,16 @@
export const initialsFromName = (name: string) =>
name
.split(' ')
.slice(0, 2)
.map((x) => x[0])
.join('')
.toUpperCase();
!!name
? name
.split(' ')
.slice(0, 2)
.map((x) => x[0])
.join('')
.toUpperCase()
: '';
export const avatarHash = (id: string, hash: string) =>
`https://cdn.discordapp.com/icons/${id}/${hash}.webp?size=256`;
export const avatarHash = (
id: string,
hash: string,
bucket: 'icons' | 'avatars' = 'icons',
size: number = 256
) => `https://cdn.discordapp.com/${bucket}/${id}/${hash}.webp?size=${size}`;