diff --git a/src/components/UserAvatar/README.md b/src/components/UserAvatar/README.md index 8f19f308b1..086f2e550d 100644 --- a/src/components/UserAvatar/README.md +++ b/src/components/UserAvatar/README.md @@ -8,5 +8,7 @@ Component for displaying user avatar. | :-------- | :--------------- | :------- | :------ | :--------------------------------------------------------- | | imgUrl | `string` | | | Link to image | | size | `UserAvatarSize` | | 'm' | Component size. Possible values: `xs`, `s`, `m`, `l`, `xl` | +| srcSet | `string` | | | `srcSet` attribute of the image | +| sizes | `string` | | | `sizes` attribute of the image | | title | `string` | | | Tooltip text on hover | | className | `string` | | | Class name | diff --git a/src/components/UserAvatar/UserAvatar.scss b/src/components/UserAvatar/UserAvatar.scss index 639118e167..7e18f9be27 100644 --- a/src/components/UserAvatar/UserAvatar.scss +++ b/src/components/UserAvatar/UserAvatar.scss @@ -3,13 +3,16 @@ $block: '.#{variables.$ns}user-avatar'; #{$block} { - box-sizing: border-box; display: inline-block; + overflow: hidden; + + box-sizing: border-box; + + border-radius: 50%; background-color: var(--yc-color-base-background); background-repeat: no-repeat; background-position: center; background-size: cover; - border-radius: 50%; &_size { &_xs { @@ -37,4 +40,8 @@ $block: '.#{variables.$ns}user-avatar'; height: 50px; } } + + &__figure { + object-fit: cover; + } } diff --git a/src/components/UserAvatar/UserAvatar.tsx b/src/components/UserAvatar/UserAvatar.tsx index 28da8c28ff..994f66f125 100644 --- a/src/components/UserAvatar/UserAvatar.tsx +++ b/src/components/UserAvatar/UserAvatar.tsx @@ -1,12 +1,14 @@ import React from 'react'; import {block} from '../utils/cn'; +import {SIZES} from './constants'; +import type {UserAvatarSize} from './types'; import './UserAvatar.scss'; -export type UserAvatarSize = 'xs' | 's' | 'm' | 'l' | 'xl'; - export interface UserAvatarProps { imgUrl?: string; size?: UserAvatarSize; + srcSet?: string; + sizes?: string; title?: string; className?: string; /** @deprecated Use appropriate component, like `