diff --git a/libs/remix-ui/solidity-uml-gen/src/lib/solidity-uml-gen.tsx b/libs/remix-ui/solidity-uml-gen/src/lib/solidity-uml-gen.tsx index be3d8b18fd..6678fe1f62 100644 --- a/libs/remix-ui/solidity-uml-gen/src/lib/solidity-uml-gen.tsx +++ b/libs/remix-ui/solidity-uml-gen/src/lib/solidity-uml-gen.tsx @@ -1,5 +1,5 @@ import { CustomTooltip } from '@remix-ui/helper' -import React, { Fragment, useEffect, useState } from 'react' +import React, { Fragment, useEffect, useRef, useState } from 'react' import { TransformComponent, TransformWrapper } from 'react-zoom-pan-pinch' import { ISolidityUmlGen } from '../types' import './css/solidity-uml-gen.css' @@ -37,7 +37,7 @@ const ActionButtons = ({ buttons }: ActionButtonsProps) => ( disabled={!btn.svgValid} onClick={btn.action} > - + ))} @@ -48,6 +48,8 @@ export function RemixUiSolidityUmlGen ({ plugin, updatedSvg, loading, themeSelec const [showViewer, setShowViewer] = useState(false) const [svgPayload, setSVGPayload] = useState('') const [validSvg, setValidSvg] = useState(false) + const svgRef = useRef(null) + const buttonsRef = useRef(null) @@ -57,12 +59,24 @@ export function RemixUiSolidityUmlGen ({ plugin, updatedSvg, loading, themeSelec } , [updatedSvg]) + useEffect(() => { + svgRef?.current?.addEventListener('mouseover', () => console.log('move over the image'))//buttonsRef?.current?.classList.remove('d-none')) + svgRef?.current?.addEventListener('mouseout', () => console.log('mouse out of the image')) //buttonsRef?.current?.classList.add('d-none')) + const svgimg = document.querySelector('#umlImage') as HTMLImageElement + svgimg?.addEventListener('mouseover', () => console.log('mouse over the image')) + svgimg?.addEventListener('mouseout', () => console.log('mouse out of the image')) + return () => { + svgRef?.current?.removeEventListener('mouseover', () => buttonsRef?.current?.classList.remove('d-none')) + svgRef?.current?.removeEventListener('mouseout', () => buttonsRef?.current?.classList.add('d-none')) + } + },[]) + const buttons: ButtonAction[] = [ { buttonText: 'Download as PDF', svgValid: () => validSvg, action: () => console.log('generated!!'), - icon: 'fa mr-1 pt-1 pb-1 fa-file' + icon: 'fa fa-file' }, { buttonText: 'Download as PNG', @@ -82,8 +96,7 @@ export function RemixUiSolidityUmlGen ({ plugin, updatedSvg, loading, themeSelec const Display = () => { const invert = themeSelected === 'dark' ? 'invert(0.8)' : 'invert(0)' return ( -
-
+
{ validSvg && showViewer ? ( ( - - - + + + +
+ + @@ -108,7 +136,6 @@ export function RemixUiSolidityUmlGen ({ plugin, updatedSvg, loading, themeSelec
: }
- )} return (<> { }