Skip to content

Commit 15b879b

Browse files
author
Гамидов Шамсудин Селимханович
committed
feat(INTERNAL-2220): user avatar fix
1 parent 026f013 commit 15b879b

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

src/plasma/UserAvatar/UserAvatar.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ export const Default: StoryObj<typeof UserAvatar> = {
2121
email: 'john_doe_77@taskany-inc.io',
2222
domain: 'www.gravatar.com',
2323
name: 'John Doe',
24+
shape: 'rounded',
2425
},
2526
};

src/plasma/UserAvatar/UserAvatar.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Avatar } from '@salutejs/plasma-web';
2+
import cn from 'classnames';
23
import React, { useEffect, useState } from 'react';
34
import md5Hash from 'md5';
45

@@ -7,6 +8,8 @@ import { getInitials } from '../../utils/getInitials';
78
import { isRetina } from '../../utils/isRetina';
89
import { Circle } from '../Circle/Circle';
910

11+
import s from './UserAvatarModule.module.css';
12+
1013
interface UserAvatarProps {
1114
size?: 's' | 'm' | 'l' | 'xl' | 'xxl' | 'fit';
1215
email?: string | null;
@@ -28,10 +31,10 @@ const sizesMap = {
2831
};
2932

3033
export const UserAvatar: React.FC<UserAvatarProps> = ({
31-
size = 'xxl',
34+
size = 'l',
3235
rating = 'g',
3336
def = 'retro',
34-
shape = 'rounded',
37+
shape = 'circled',
3538
domain = process.env.NEXT_PUBLIC_GRAVATAR_HOST || 'www.gravatar.com',
3639
email,
3740
md5,
@@ -84,7 +87,7 @@ export const UserAvatar: React.FC<UserAvatarProps> = ({
8487
};
8588

8689
return !isLoad || isError ? (
87-
<Circle size={sizesMap[size]} string={`${email}`}>
90+
<Circle size={sizesMap[size]} string={`${email}`} className={cn({ [s.Rounded]: shape === 'rounded' })}>
8891
{getInitials(name)}
8992
</Circle>
9093
) : (
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.Rounded {
2+
border-radius: 18px;
3+
}

0 commit comments

Comments
 (0)