@@ -21,6 +21,7 @@ import {
21
21
ComponentSizeType ,
22
22
handleAnalyticsEvent ,
23
23
Icon ,
24
+ ImageWithFallback ,
24
25
noop ,
25
26
stopPropagation ,
26
27
useMainContext ,
@@ -29,9 +30,8 @@ import {
29
30
import { ReactComponent as ICCaretSmall } from '@Icons/ic-caret-left-small.svg'
30
31
import { InteractiveCellText } from '@Components/common/helpers/InteractiveCellText/InteractiveCellText'
31
32
32
- import placeHolder from '../../assets/icons/ic-default-chart.svg'
33
+ import { ReactComponent as Helm } from '../../assets/icons/ic-default-chart.svg'
33
34
import { SERVER_MODE } from '../../config'
34
- import { LazyImage } from '../common'
35
35
import { ChartSelectProps } from './charts.types'
36
36
import { renderDeprecatedWarning } from './charts.util'
37
37
@@ -46,12 +46,6 @@ const ChartCard = ({
46
46
} : ChartSelectProps ) => {
47
47
const { serverMode } = useMainContext ( )
48
48
49
- const handleImageError = ( e ) : void => {
50
- const target = e . target as HTMLImageElement
51
- target . onerror = null
52
- target . src = placeHolder
53
- }
54
-
55
49
const addChartTab = ( e ) : void => {
56
50
stopPropagation ( e )
57
51
addChart ( chart . id )
@@ -95,13 +89,19 @@ const ChartCard = ({
95
89
ariaLabel = "Remove chart from selection"
96
90
/>
97
91
)
92
+ const chartIconClass = 'dc__chart-grid-item__icon chart-icon-dim br-4 dc__no-shrink'
98
93
99
94
const renderIcon = ( ) => (
100
95
< div className = "icon-wrapper" >
101
- < LazyImage
102
- className = { `${ isListView ? 'dc__list-icon' : '' } dc__chart-grid-item__icon chart-icon-dim br-4` }
103
- src = { chart . icon }
104
- onError = { handleImageError }
96
+ < ImageWithFallback
97
+ imageProps = { {
98
+ height : 32 ,
99
+ width : 32 ,
100
+ src : chart . icon ,
101
+ alt : 'chart' ,
102
+ className : chartIconClass ,
103
+ } }
104
+ fallbackImage = { < Helm className = { chartIconClass } /> }
105
105
/>
106
106
</ div >
107
107
)
0 commit comments