Add onClick event to Image widget (#1639)

This commit is contained in:
Sherfin Shamsudeen 2021-12-25 16:34:15 +05:30 committed by GitHub
parent 26e0da7f54
commit f75b5eb4d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,7 +1,7 @@
import React from 'react';
import LazyLoad from 'react-lazyload';
export const Image = function Image({ height, properties, styles }) {
export const Image = function Image({ height, properties, styles, fireEvent }) {
const source = properties.source;
const widgetVisibility = styles.visibility ?? true;
@ -12,7 +12,7 @@ export const Image = function Image({ height, properties, styles }) {
return (
<div data-disabled={styles.disabledState} style={{ display: widgetVisibility ? '' : 'none' }}>
<LazyLoad height={height} placeholder={<Placeholder />} debounce={500}>
<img src={source} height={height} />
<img src={source} height={height} onClick={() => fireEvent('onClick')} />
</LazyLoad>
</div>
);