forked from TamimEhsan/AlgorithmVisualizer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathslider.jsx
More file actions
47 lines (42 loc) · 1.26 KB
/
Copy pathslider.jsx
File metadata and controls
47 lines (42 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import Typography from '@material-ui/core/Typography';
import Slider from '@material-ui/core/Slider';
const useStyles = makeStyles({
root: {
width: 200,
},
});
function valuetext(value) {
return `${value}`;
}
export default function DiscreteSlider(props) {
const classes = useStyles();
const handleChange = (event) =>{
if( event.target.innerText === "" ){
return;
}
const num = parseInt(event.target.innerText,10);
props.onCountChange(num);
}
return (
<div className={classes.root+" ml-2 mr-2"}>
<Slider
defaultValue={props.default}
getAriaValueText={valuetext}
aria-labelledby="discrete-slider"
valueLabelDisplay="auto"
onChangeCommitted={handleChange}
step={props.step}
// marks={props.marks}
min={props.min}
max={props.max}
valueLabelDisplay="on"
disabled={props.disable}
/>
<Typography id="discrete-slider" gutterBottom>
{props.title}
</Typography>
</div>
);
}