File tree 1 file changed +15
-4
lines changed
1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import Backers from './support-backers.json' ;
3
3
import Additional from './support-additional.js' ;
4
+ import SmallIcon from '../../assets/icon-square-small-slack.png' ;
4
5
import './Support.scss' ;
5
6
6
7
const SUPPORTERS = [ ...Backers ] ;
@@ -100,11 +101,11 @@ export default class Support extends React.Component {
100
101
title = { `$${ formatMoney ( supporter . totalDonations / 100 ) } by ${ supporter . name || supporter . slug } ` }
101
102
target = "_blank"
102
103
href = { supporter . website || `https://opencollective.com/${ supporter . slug } ` } >
103
- { supporter . avatar ? < img
104
+ { < img
104
105
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 } /> }
108
109
{ rank === 'backer' ? < figure className = "support__outline" /> : null }
109
110
</ a >
110
111
) )
@@ -118,4 +119,14 @@ export default class Support extends React.Component {
118
119
</ div >
119
120
) ;
120
121
}
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
+ }
121
132
}
You can’t perform that action at this time.
0 commit comments