forked from TamimEhsan/AlgorithmVisualizer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimpleSelect.jsx
More file actions
51 lines (47 loc) · 1.67 KB
/
simpleSelect.jsx
File metadata and controls
51 lines (47 loc) · 1.67 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
48
49
50
51
import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import InputLabel from '@material-ui/core/InputLabel';
import MenuItem from '@material-ui/core/MenuItem';
import FormHelperText from '@material-ui/core/FormHelperText';
import FormControl from '@material-ui/core/FormControl';
import Select from '@material-ui/core/Select';
const useStyles = makeStyles((theme) => ({
formControl: {
margin: theme.spacing(1),
minWidth: 120,
},
selectEmpty: {
marginTop: theme.spacing(2),
},
}));
const SimpleSelect = (props) => {
const classes = useStyles();
const [age, setAge] = React.useState('0');
const [state, setState] = React.useState({
pos: props.pos,
});
const handleChange = (event) => {
console.log(state.pos);
setAge(event.target.value);
props.onAlgoChanged(state.pos,event.target.value);
};
return (
<div className="ml-2 mr-2">
<FormControl className={classes.formControl}>
<InputLabel id="demo-simple-select-label">Algorithm</InputLabel>
<Select
labelId="demo-simple-select-label"
id="demo-simple-select"
value={age}
onChange={handleChange}
>
<MenuItem value={0} style={{selected:true}} >Bubble Sort</MenuItem>
<MenuItem value={1}>Selection Sort</MenuItem>
<MenuItem value={2}>Insertion Sort</MenuItem>
<MenuItem value={3}>Quick Sort</MenuItem>
</Select>
</FormControl>
</div>
);
}
export default SimpleSelect;