Skip to content

Commit

Permalink
fix image
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubinquitous committed Mar 5, 2024
1 parent fa9dd2a commit 75c18d1
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/components/atoms/FallbackImgImage.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from "react";
import Image, { ImageProps, StaticImageData } from "next/image";
import { ImageProps } from "next/image";
import styled, { css } from "styled-components";
import { StaticImport } from "next/dist/shared/lib/get-img-props";

interface FallbackImgImageProps extends ImageProps {
fallbackSrc: StaticImageData | string;
fallbackSrc: string;
alt: string;
sizes?: string;
rounded?: boolean;
isShouldHide?: boolean;
src: string;
}

const FallbackImgImage = ({
Expand All @@ -20,12 +20,10 @@ const FallbackImgImage = ({
rounded,
...props
}: FallbackImgImageProps) => {
const [imgSrc, setImgSrc] = React.useState<
StaticImageData | StaticImport | string
>("");
const [imgSrc, setImgSrc] = React.useState<string>("");

React.useEffect(() => {
setImgSrc(src ?? "/");
setImgSrc(src);
}, [src]);

return (
Expand Down

0 comments on commit 75c18d1

Please sign in to comment.