LightBox.tsx 388 B

1234567891011121314151617
  1. import React, { useState } from 'react';
  2. import FsLightbox from 'fslightbox-react';
  3. export const LightBox = (props) => {
  4. const [toggler, setToggler] = useState(false);
  5. return (
  6. <>
  7. <img {...props.node.properties} onClick={() => setToggler(!toggler)} />
  8. <FsLightbox
  9. toggler={toggler}
  10. sources={[props.src]}
  11. type="image"
  12. />
  13. </>
  14. );
  15. };