File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change 11import React from 'react' ;
22import Backers from './support-backers.json' ;
33import Additional from './support-additional.js' ;
4+ import SmallIcon from '../../assets/icon-square-small-slack.png' ;
45import './Support.scss' ;
56
67const SUPPORTERS = [ ...Backers ] ;
@@ -100,11 +101,11 @@ export default class Support extends React.Component {
100101 title = { `$${ formatMoney ( supporter . totalDonations / 100 ) } by ${ supporter . name || supporter . slug } ` }
101102 target = "_blank"
102103 href = { supporter . website || `https://opencollective.com/${ supporter . slug } ` } >
103- { supporter . avatar ? < img
104+ { < img
104105 className = { `support__${ rank } -avatar` }
105- src = { supporter . avatar }
106- alt = { supporter . name || supporter . slug ? `${ supporter . name || supporter . slug } 's avatar` : 'avatar' } /> :
107- < span className = { `support__ ${ rank } -avatar` } > { supporter . name || supporter . slug } </ span > }
106+ src = { supporter . avatar || SmallIcon }
107+ alt = { supporter . name || supporter . slug ? `${ supporter . name || supporter . slug } 's avatar` : 'avatar' }
108+ onError = { this . _handleImgError } /> }
108109 { rank === 'backer' ? < figure className = "support__outline" /> : null }
109110 </ a >
110111 ) )
@@ -118,4 +119,14 @@ export default class Support extends React.Component {
118119 </ div >
119120 ) ;
120121 }
122+
123+ /**
124+ * Handle images that aren't found
125+ *
126+ * @param {object } e - React synthetic event
127+ */
128+ _handleImgError ( e ) {
129+ const imgNode = e . target ;
130+ imgNode . src = SmallIcon ;
131+ }
121132}
You can’t perform that action at this time.
0 commit comments