Skip to content

Commit

Permalink
Show unknown icon when image cannot be loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
EliteAsian123 committed Sep 29, 2024
1 parent 589fa8a commit 93b74e5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Binary file added src/assets/Unknown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion src/components/ProfileIcon/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Img } from "react-image";
import styles from "./ProfileIcon.module.css";
import { processAssetUrl } from "@app/profiles/utils";
import UnknownImage from "@app/assets/Unknown.png";

interface Props {
iconUrl: string;
Expand All @@ -8,7 +10,7 @@ interface Props {

const ProfileIcon: React.FC<Props> = ({ iconUrl, className }: Props) => {
return <div className={[styles.icon, className].join(" ")}>
<img src={processAssetUrl(iconUrl)} />
<Img src={[processAssetUrl(iconUrl), UnknownImage]} />
</div>;
};

Expand Down

0 comments on commit 93b74e5

Please sign in to comment.