import { MdCameraAlt } from 'react-icons/md' ; import LinkBtn from './LinkBtn' ; function SnapshotBtn ( ) { return ( < LinkBtn label = "Snapshot" icon = { MdCameraAlt } href = "/" target = "_blank" download = "snapshot" onClick = { ( evt ) => { const canvas = document . querySelector ( 'canvas' ) ; const url = canvas ?. toDataURL ( ) ; if ( ! url ) { evt . preventDefault ( ) ; return ; } evt . currentTarget . setAttribute ( 'href' , url ) ; } } />); } export default SnapshotBtn ;