@@ -5,9 +5,13 @@ import { sigil, stringRenderer } from 'urbit-sigil-js';
6import { dataURItoBlob, loadImg, initCanvas } from 'lib/SigilDownloader';
6import { dataURItoBlob, loadImg, initCanvas } from 'lib/SigilDownloader';
8−import WithTooltip from 'components/WithTooltip';
8+import { DownloadButton } from 'components/Buttons';
10−export default function SigilDownloader({ point, children }) {
10+export default function DownloadSigilButton({
12+ children = 'Download Sigil',
11 const [downloaded, setDownloaded] = useState(false);
15 const [downloaded, setDownloaded] = useState(false);
12 const downloadSigil = () => {
16 const downloadSigil = () => {
13 const patp = ob.patp(point);
17 const patp = ob.patp(point);
@@ -24,7 +28,6 @@ export default function SigilDownloader({ point, children }) {
24 // make sigil svg and encoded into base64
28 // make sigil svg and encoded into base64
25 const svg = sigil({
29 const svg = sigil({
28 renderer: stringRenderer,
31 renderer: stringRenderer,
29 size: _size,
32 size: _size,
30 colors: ['#FFFFFF', '#000000'],
33 colors: ['#FFFFFF', '#000000'],
@@ -52,11 +55,18 @@ export default function SigilDownloader({ point, children }) {
52 const canvasRef = useRef(null);
55 const canvasRef = useRef(null);
61+ disabled={downloaded}
62+ onClick={downloadSigil}
55− <WithTooltip content={downloaded ? 'Downloaded!' : 'Download'}>
64+ downloaded ? 'Downloaded!' : 'Download the sigil for this point'
56− {React.Children.map(children, child =>
67+ {children}
57− React.cloneElement(child, { onClick: downloadSigil })
68+ </DownloadButton>
59 <canvas style={{ display: 'none' }} ref={canvasRef} />
69 <canvas style={{ display: 'none' }} ref={canvasRef} />
60− </WithTooltip>
70+ </>