|
1 | 1 | import React from 'react'
|
2 | 2 |
|
3 | 3 | export default function Controls ({
|
4 |
| - onFileChange, |
5 | 4 | chunker,
|
6 | 5 | onChunkerChange,
|
7 | 6 | strategy,
|
8 | 7 | onStrategyChange,
|
9 | 8 | maxChildren,
|
10 | 9 | onMaxChildrenChange,
|
11 | 10 | layerRepeat,
|
12 |
| - onLayerRepeatChange |
| 11 | + onLayerRepeatChange, |
| 12 | + onReset |
13 | 13 | }) {
|
14 | 14 | return (
|
15 |
| - <div className='pa3 bg-white'> |
16 |
| - <input type='file' className='input avenir' onChange={e => onFileChange(e.target.files[0])} /> |
17 |
| - <select value={chunker} onChange={e => onChunkerChange(e.target.value)}> |
18 |
| - <option value='size-32'>32 byte chunks</option> |
19 |
| - <option value='size-512'>512 byte chunks</option> |
20 |
| - <option value='size-1024'>1,024 byte chunks</option> |
21 |
| - <option value='size-16384'>16,384 byte chunks</option> |
22 |
| - <option value='size-262144'>26,2144 byte chunks</option> |
23 |
| - </select> |
24 |
| - <select value={strategy} onChange={e => onStrategyChange(e.target.value)}> |
25 |
| - <option value='balanced'>Balanced DAG</option> |
26 |
| - <option value='trickle'>Trickle DAG</option> |
27 |
| - <option value='flat'>Flat DAG</option> |
28 |
| - </select> |
29 |
| - {['balanced', 'trickle'].includes(strategy) ? ( |
30 |
| - <select value={maxChildren} onChange={e => onMaxChildrenChange(parseInt(e.target.value))}> |
31 |
| - <option value='11'>11 children max</option> |
32 |
| - <option value='44'>44 children max</option> |
33 |
| - <option value='174'>174 children max</option> |
| 15 | + <div className='flex flex-row items-center pa3 bg-white'> |
| 16 | + <div className='mr3'> |
| 17 | + <select |
| 18 | + value={chunker} |
| 19 | + onChange={e => onChunkerChange(e.target.value)} |
| 20 | + className='charcoal ba b--black-20 br1 pv1 ph2 db center focus-outline'> |
| 21 | + <option value='size-32'>32 byte chunks</option> |
| 22 | + <option value='size-512'>512 byte chunks</option> |
| 23 | + <option value='size-1024'>1,024 byte chunks</option> |
| 24 | + <option value='size-16384'>16,384 byte chunks</option> |
| 25 | + <option value='size-262144'>26,2144 byte chunks</option> |
| 26 | + </select> |
| 27 | + </div> |
| 28 | + <div className='mr3'> |
| 29 | + <select |
| 30 | + value={strategy} |
| 31 | + onChange={e => onStrategyChange(e.target.value)} |
| 32 | + className='charcoal ba b--black-20 br1 pv1 ph2 db center focus-outline'> |
| 33 | + <option value='balanced'>Balanced DAG</option> |
| 34 | + <option value='trickle'>Trickle DAG</option> |
| 35 | + <option value='flat'>Flat DAG</option> |
34 | 36 | </select>
|
| 37 | + </div> |
| 38 | + {['balanced', 'trickle'].includes(strategy) ? ( |
| 39 | + <div className='mr3'> |
| 40 | + <select |
| 41 | + value={maxChildren} |
| 42 | + onChange={e => onMaxChildrenChange(parseInt(e.target.value))} |
| 43 | + className='charcoal ba b--black-20 br1 pv1 ph2 db center focus-outline'> |
| 44 | + <option value='11'>11 children max</option> |
| 45 | + <option value='44'>44 children max</option> |
| 46 | + <option value='174'>174 children max</option> |
| 47 | + </select> |
| 48 | + </div> |
35 | 49 | ) : null}
|
36 | 50 | {strategy === 'trickle' ? (
|
37 |
| - <select value={layerRepeat} onChange={e => onLayerRepeatChange(parseInt(e.target.value))}> |
38 |
| - <option value='1'>1 layer repeat</option> |
39 |
| - <option value='4'>4 layer repeats</option> |
40 |
| - <option value='16'>16 layer repeats</option> |
41 |
| - </select> |
| 51 | + <div className='mr3'> |
| 52 | + <select |
| 53 | + value={layerRepeat} |
| 54 | + onChange={e => onLayerRepeatChange(parseInt(e.target.value))} |
| 55 | + className='charcoal ba b--black-20 br1 pv1 ph2 db center focus-outline'> |
| 56 | + <option value='1'>1 layer repeat</option> |
| 57 | + <option value='4'>4 layer repeats</option> |
| 58 | + <option value='16'>16 layer repeats</option> |
| 59 | + </select> |
| 60 | + </div> |
42 | 61 | ) : null}
|
| 62 | + <div className='flex-auto' /> |
| 63 | + <button |
| 64 | + type='button' |
| 65 | + onClick={e => onReset()} |
| 66 | + className='transition-all sans-serif dib v-mid fw5 nowrap lh-copy bn br1 ph4 pv1 pointer focus-outline bg-gray hover-bg-red white' |
| 67 | + title='Clear file(s) and reset controls to defaults'> |
| 68 | + Reset |
| 69 | + </button> |
43 | 70 | </div>
|
44 | 71 | )
|
45 | 72 | }
|
0 commit comments