Updated cursor on hovering image widget (#3080)

This commit is contained in:
Kavin Venkatachalam 2022-05-24 03:37:51 +05:30 committed by GitHub
parent 4b68627431
commit d6b941227e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,9 +2,13 @@ import React, { useRef, useEffect, useState } from 'react';
import LazyLoad from 'react-lazyload';
import { TransformWrapper, TransformComponent } from 'react-zoom-pan-pinch';
export const Image = function Image({ height, properties, styles, fireEvent, width }) {
export const Image = function Image({ component, height, properties, styles, fireEvent, width }) {
const { source, loadingState, alternativeText, zoomButtons } = properties;
const { visibility, disabledState, borderType, backgroundColor, padding, imageFit } = styles;
const {
definition: { events },
} = component;
const hasOnClickEvent = events.some((event) => event.eventId === 'onClick');
const widgetVisibility = visibility ?? true;
const imageRef = useRef(null);
const [imageOffset, setImageOffset] = useState(0);
@ -60,6 +64,8 @@ export const Image = function Image({ height, properties, styles, fireEvent, wid
backgroundColor,
padding: Number.parseInt(padding),
objectFit: imageFit ? imageFit : 'contain',
cursor: hasOnClickEvent ? 'pointer' : 'inherit',
pointerEvents: 'auto',
}}
height={height}
onClick={() => fireEvent('onClick')}