on 703ff86 help sign in
bridge/src/components/ProgressButton.jsx
30 lines 629 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 ...rest
11}) {
12 return (
13 <As
14 {...rest}
15 solid
16 accessory={blinkIf(progress < 1.0, '->')}
17 background={
18 <span
19 className={cn('abs z1 animated-width', `bg-${color}`)}
20 style={{
21 left: 0,
22 top: 0,
23 right: 0,
24 bottom: 0,
25 width: `${progress * 100.0}%`,
26 }}></span>
27 }
28 />
29 );