Skip to content

Commit

Permalink
feat: use Image in Noise component
Browse files Browse the repository at this point in the history
  • Loading branch information
hmerritt committed Nov 6, 2023
1 parent 3c53c02 commit 64ac6f2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/lib/styles/global/reset.scss
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ strong {
}

img {
transition: opacity 100ms ease-in-out;
transition: opacity 80ms ease-in-out;
}

svg {
Expand Down
12 changes: 10 additions & 2 deletions src/view/components/experimental/Noise.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { css, cx } from "@linaria/core";
import { useEffect, useRef } from "react";

import { Image, ImageProps } from "../Image";

const canvasNoise = (
ctx: CanvasRenderingContext2D,
patternSize = 64,
Expand Down Expand Up @@ -37,7 +39,7 @@ export type NoiseProps = {
export type NoiseImgProps = NoiseProps &
JSX.IntrinsicElements["div"] & {
src?: string;
imgProps?: JSX.IntrinsicElements["img"];
imgProps?: ImageProps;
};

/**
Expand Down Expand Up @@ -108,7 +110,13 @@ export const NoiseImg = ({
}: NoiseImgProps) => {
return (
<div className={cx(noiseImg, className)} {...divProps}>
<img src={src} width="100%" height="100%" draggable={false} {...imgProps} />
<Image
src={src}
width="100%"
height="100%"
hideWhileLoading={true}
{...imgProps}
/>
<Noise
framerate={framerate}
size={size}
Expand Down

0 comments on commit 64ac6f2

Please sign in to comment.