From 168387237e383cc8412d04ef6450deb8102e968c Mon Sep 17 00:00:00 2001 From: Sean Boult <996134+Hacksore@users.noreply.github.com> Date: Fri, 24 Mar 2023 20:06:57 -0500 Subject: [PATCH] Add fallback image --- .gitignore | 1 - public/default.png | Bin 0 -> 755 bytes src/components/Person.js | 4 ++++ 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 public/default.png diff --git a/.gitignore b/.gitignore index c1df6902..0ae3e696 100644 --- a/.gitignore +++ b/.gitignore @@ -56,7 +56,6 @@ typings/ .env* .cache/ -public # Mac files .DS_Store diff --git a/public/default.png b/public/default.png new file mode 100644 index 0000000000000000000000000000000000000000..d0cafecdbe600d0654d1c8d962e17ecf9f07a216 GIT binary patch literal 755 zcmVJ8loC=S@QdTC>@VT!MU}K`es1x7}{Z1-OnjWU1DX`FyS#paAFNI$G2VB0`aL z@IzucostX02@#blibu1_pur4u&BjD55j42jYz9F{+jtI0t=DTh91gK&#>gTN=yW=X z2|N;arzKPbfd}bL8%3p{t6{1Sdpb`CJ0u2!!P_JN{x{kXmPlCCV4cM4F)gM-w!tol$O*12z{3p*Z=3 l!+f6cPX50R@{QDp`~sQ@Ez~5eFB<>=002ovPDHLkV1mG%K`#IR literal 0 HcmV?d00001 diff --git a/src/components/Person.js b/src/components/Person.js index 9f359179..904c4d76 100644 --- a/src/components/Person.js +++ b/src/components/Person.js @@ -20,6 +20,10 @@ export default function Person({ person }) { height="50" src={img} alt={person.name} + onError={({ currentTarget }) => { + currentTarget.onerror = null; // prevents looping + currentTarget.src = "/default.png"; + }} loading="lazy" />