3636
3737import React from 'react' ;
3838import PropTypes from 'prop-types' ;
39- import ReactBootstrapSlider from 'react-bootstrap-slider' ;
4039import Button from 'react-bootstrap/Button' ;
4140import Form from 'react-bootstrap/Form' ;
4241
42+ import Slider from 'react-rangeslider' ;
43+ import 'react-rangeslider/lib/index.css' ;
44+
4345const ControlPanel = props => {
4446 const {
47+ delay,
48+ scanRepeat,
49+ maxScans,
50+ animationDuration,
51+ writeDelay,
52+ writeScanRepeat,
4553 onDelayChange,
4654 onMaxScansChange,
4755 onChannelScanRepeatChange,
@@ -51,48 +59,46 @@ const ControlPanel = props => {
5159 onToggleLED,
5260 disabled,
5361 } = props ;
54- const sliderDisabled = disabled ? 'disabled' : null ;
5562 return (
5663 < Form >
57- Sweep Delay (ms)< br / >
58- < ReactBootstrapSlider
59- value = { 10 }
60- slideStop = { event => onDelayChange ( event . target . value ) }
64+ < Form . Label > Sweep Delay (ms)</ Form . Label >
65+ < Slider
66+ value = { delay }
67+ title = { delay }
6168 max = { 1000 }
6269 min = { 5 }
63- ticks = { [ 5 , 1000 ] }
64- ticks_labels = { [ '5' , '1000' ] }
65- disabled = { sliderDisabled }
70+ onChangeComplete = { writeDelay }
71+ onChange = { value => onDelayChange ( value ) }
72+ labels = { { 5 : '5' , [ delay ] : `${ delay } ` , 1000 : '1000' } }
73+ tooltip = { false }
6674 />
67- # of sweeps to display maximum value
68- < ReactBootstrapSlider
69- value = { 30 }
70- slideStop = { event => onMaxScansChange ( event . target . value ) }
75+ < Form . Label > # of sweeps to display maximum value</ Form . Label >
76+ < Slider
77+ value = { maxScans }
7178 max = { 100 }
7279 min = { 1 }
73- ticks = { [ 1 , 100 ] }
74- ticks_labels = { [ '1' , '100' ] }
75- disabled = { sliderDisabled }
80+ onChange = { value => onMaxScansChange ( value ) }
81+ labels = { { 1 : '1' , [ maxScans ] : ` ${ maxScans } ` , 100 : '100' } }
82+ tooltip = { false }
7683 />
77- Channel scan repeat
78- < ReactBootstrapSlider
79- value = { 1 }
80- slideStop = { event => onChannelScanRepeatChange ( event . target . value ) }
84+ < Form . Label > Channel scan repeat</ Form . Label >
85+ < Slider
86+ value = { scanRepeat }
8187 max = { 100 }
8288 min = { 1 }
83- ticks = { [ 1 , 100 ] }
84- ticks_labels = { [ '1' , '100' ] }
85- disabled = { sliderDisabled }
89+ onChangeComplete = { writeScanRepeat }
90+ onChange = { value => onChannelScanRepeatChange ( value ) }
91+ labels = { { 1 : '1' , [ scanRepeat ] : `${ scanRepeat } ` , 100 : '100' } }
92+ tooltip = { false }
8693 />
87- Animation duration (ms)
88- < ReactBootstrapSlider
89- value = { 500 }
90- slideStop = { event => onAnimationDurationChange ( event . target . value ) }
94+ < Form . Label > Animation duration (ms)</ Form . Label >
95+ < Slider
96+ value = { animationDuration }
9197 max = { 1000 }
9298 min = { 10 }
93- ticks = { [ 10 , 1000 ] }
94- ticks_labels = { [ '10' , '1000' ] }
95- disabled = { sliderDisabled }
99+ onChange = { value => onAnimationDurationChange ( value ) }
100+ labels = { { 10 : '10' , [ animationDuration ] : ` ${ animationDuration } ` , 1000 : '1000' } }
101+ tooltip = { false }
96102 />
97103 < Form . Group controlId = "advCheck" >
98104 < Form . Check
@@ -116,6 +122,12 @@ const ControlPanel = props => {
116122} ;
117123
118124ControlPanel . propTypes = {
125+ delay : PropTypes . number . isRequired ,
126+ scanRepeat : PropTypes . number . isRequired ,
127+ maxScans : PropTypes . number . isRequired ,
128+ animationDuration : PropTypes . number . isRequired ,
129+ writeDelay : PropTypes . func . isRequired ,
130+ writeScanRepeat : PropTypes . func . isRequired ,
119131 onDelayChange : PropTypes . func . isRequired ,
120132 onMaxScansChange : PropTypes . func . isRequired ,
121133 onChannelScanRepeatChange : PropTypes . func . isRequired ,
0 commit comments