import { IconType } from '@standardnotes/snjs' import { FunctionComponent, useRef, useState } from 'react' import IconButton from '../Button/IconButton' type Props = { objectUrl: string } const ImagePreview: FunctionComponent = ({ objectUrl }) => { const initialImgHeightRef = useRef() const [imageZoomPercent, setImageZoomPercent] = useState(100) return (
{ if (!initialImgHeightRef.current) { initialImgHeightRef.current = imgElement?.height } }} />
Zoom: { setImageZoomPercent((percent) => { const newPercent = percent - 10 if (newPercent >= 10) { return newPercent } else { return percent } }) }} /> {imageZoomPercent}% { setImageZoomPercent((percent) => percent + 10) }} />
) } export default ImagePreview