Skip to content

Commit

Permalink
Get rid of transitions on placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanoverna committed Nov 11, 2022
1 parent 7e058b5 commit c7624b2
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions src/Image/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,22 +265,21 @@ export const Image = forwardRef<HTMLDivElement, ImagePropTypes>(
const transition =
fadeInDuration > 0 ? `opacity ${fadeInDuration}ms` : undefined;

const placeholder = usePlaceholder ? (
<img
role="presentation"
aria-hidden="true"
alt=""
src={data.base64 ?? undefined}
style={{
backgroundColor: data.bgColor ?? undefined,
opacity: showImage ? 0 : 1,
transition,
objectFit,
objectPosition,
...absolutePositioning,
}}
/>
) : null;
const placeholder =
usePlaceholder && (data.bgColor || data.base64) ? (
<img
role="presentation"
aria-hidden="true"
alt=""
src={data.base64 ?? undefined}
style={{
backgroundColor: data.bgColor ?? undefined,
objectFit,
objectPosition,
...absolutePositioning,
}}
/>
) : null;

const { width, aspectRatio } = data;
const height = data.height || width / aspectRatio;
Expand Down

0 comments on commit c7624b2

Please sign in to comment.