on 01a3773 help sign in
bridge/src/components/ProgressButton.js
32 lines 671 B history raw
1import React from 'react';
2import cn from 'classnames';
3import { Button } from 'indigo-react';
4import { blinkIf } from './Blinky';
6export default function ProgressButton({
7 as: As = Button,
8 progress = 0.0,
9 color = 'green4',
10 success = true,
11 ...rest
12}) {
13 return (
14 <As
15 {...rest}
16 solid
17 success={success}
18 accessory={blinkIf(progress < 1.0, '->')}
19 background={
20 <span
21 className={cn('abs z1 animated-width', `bg-${color}`)}
22 style={{
23 left: 0,
24 top: 0,
25 right: 0,
26 bottom: 0,
27 width: `${progress * 100.0}%`,
28 }}></span>
29 }
30 />
31 );