Skip to content

Commit

Permalink
Switch to fetchPriority
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanoverna committed Apr 27, 2023
1 parent cff8d03 commit e28b1ba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions react-extras.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AriaAttributes } from 'react';
import { HTMLAttributes } from 'react';

declare module 'react' {
interface ImgHTMLAttributes<T> extends HTMLAttributes<T> {
fetchpriority?: 'auto' | 'low' | 'high';
fetchPriority?: 'auto' | 'low' | 'high';
}
}
12 changes: 6 additions & 6 deletions src/Image/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,10 @@ export const Image = forwardRef<HTMLDivElement, ImagePropTypes>(
...(layout === 'fill'
? absolutePositioning
: layout === 'intrinsic'
? { position: 'relative', width: '100%', maxWidth: width }
: layout === 'fixed'
? { position: 'relative', width }
: { position: 'relative', width: '100%' }),
? { position: 'relative', width: '100%', maxWidth: width }
: layout === 'fixed'
? { position: 'relative', width }
: { position: 'relative', width: '100%' }),
...style,
}}
>
Expand All @@ -375,7 +375,7 @@ export const Image = forwardRef<HTMLDivElement, ImagePropTypes>(
alt={data.alt ?? ''}
title={data.title ?? undefined}
onLoad={handleLoad}
fetchpriority={priority ? 'high' : undefined}
fetchPriority={priority ? 'high' : undefined}
className={pictureClassName}
style={{
opacity: showImage ? 1 : 0,
Expand Down Expand Up @@ -406,7 +406,7 @@ export const Image = forwardRef<HTMLDivElement, ImagePropTypes>(
...pictureStyle,
}}
loading={lazyLoad ? 'lazy' : undefined}
fetchpriority={priority ? 'high' : undefined}
fetchPriority={priority ? 'high' : undefined}
/>
)}
</picture>
Expand Down

0 comments on commit e28b1ba

Please sign in to comment.