Skip to content

Commit

Permalink
fix(ImageBase): support elementtiming (#8127)
Browse files Browse the repository at this point in the history
h2. Release notes
h2. Исправления
- ImageBase: добавлено свойство `elementTiming` для поддержки [elementtiming](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/elementtiming)
- Avatar: добавлено свойство `elementTiming` для поддержки [elementtiming](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/elementtiming)
- Image: добавлено свойство `elementTiming` для поддержки [elementtiming](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/elementtiming)
  • Loading branch information
inomdzhon authored Dec 27, 2024
1 parent d9cbf49 commit 4e3ad87
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/vkui/src/components/ImageBase/ImageBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ export interface ImageBaseProps
* Для корректной работы необходимо задать размеры хотя бы одной стороны картинки
*/
keepAspectRatio?: boolean;
/**
* см. https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/elementtiming
*/
elementTiming?: string;
}

const getObjectFitClassName = (objectFit: React.CSSProperties['objectFit']) => {
Expand Down Expand Up @@ -175,6 +179,7 @@ export const ImageBase: React.FC<ImageBaseProps> & {
objectPosition,
keepAspectRatio = false,
getRootRef,
elementTiming,
...restProps
}: ImageBaseProps) => {
const size = sizeProp ?? minOr([sizeToNumber(widthSize), sizeToNumber(heightSize)], defaultSize);
Expand Down Expand Up @@ -301,6 +306,8 @@ export const ImageBase: React.FC<ImageBaseProps> & {
height={heightImg}
onLoad={handleImageLoad}
onError={handleImageError}
// @ts-expect-error: TS2322 отсутствует в @types/react
elementtiming={elementTiming} // eslint-disable-line react/no-unknown-property
{...getFetchPriorityProp(fetchPriority)}
/>
)}
Expand Down

0 comments on commit 4e3ad87

Please sign in to comment.