on af19266 help sign in
bridge/src/components/DownloadKeyfileButton.js
31 lines 808 B history raw
1import React from 'react';
3import { DownloadButton } from 'components/Buttons';
4import Blinky from 'components/Blinky';
6import { usePointCursor } from 'store/pointCursor';
8import useKeyfileGenerator from 'lib/useKeyfileGenerator';
9import * as need from 'lib/need';
11export default function DownloadKeyfileButton({ className, ...rest }) {
12 const { pointCursor } = usePointCursor();
13 const point = need.point(pointCursor);
14 const {
15 generating,
16 available,
17 downloaded,
18 generateAndDownload,
19 } = useKeyfileGenerator(point);
21 return (
22 <DownloadButton
23 className={className}
24 disabled={downloaded || !available}
25 accessory={generating ? <Blinky /> : undefined}
26 onClick={generateAndDownload}
27 {...rest}>
28 Download Arvo Keyfile
29 </DownloadButton>
30 );