Skip to content

Commit

Permalink
Adding placeholder image
Browse files Browse the repository at this point in the history
  • Loading branch information
amankumarrr committed Mar 21, 2024
1 parent 752e778 commit 4ecfe63
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions components/blocks/downloadBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ const Download = (data: Downloads) => {
secondLink,
secondLinkText,
} = data;

const srcImage = img && !isImgBroken ? img : "/images/broken-image.png";
return (
<div className="col-span-1">
<div className={classNames("py-3 text-black md:px-6")}>
Expand All @@ -69,14 +71,14 @@ const Download = (data: Downloads) => {
)}
data-tina-field={tinaField(data, "img")}
>
{img && !isImgBroken && (
{img && (
<Image
onError={() => setIsImgBroken(true)}
src={img}
src={srcImage}
alt={header}
height={400}
width={210}
style={{ width: "auto", height: "100%" }}
style={{ width: "100%", height: "auto" }}
/>
)}
</div>
Expand Down
Binary file added public/images/broken-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4ecfe63

Please sign in to comment.