Create new monitor without dropdowns
This commit is contained in:
1 parent
aa36a33e4d
commit
ca689d4de8
9 files changed
+308
-34
No files matched your search
@@ -1,28 +1,29 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import PropTypes from "prop-types";
|
||||
import Autocomplete from "@mui/material/Autocomplete";
|
||||
import TextField from "@mui/material/TextField";
|
||||
|
||||
import Autocomplete from '@mui/material/Autocomplete';
|
||||
import TextField from '@mui/material/TextField';
|
||||
|
||||
const Dropdown = ({ id, label, options, onChange, value }) => {
|
||||
return (
|
||||
<Autocomplete
|
||||
id={id}
|
||||
options={options}
|
||||
getOptionLabel={(option) => option.name}
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
renderInput={(params) => <TextField {...params} label={label} />}
|
||||
/>
|
||||
);
|
||||
const Dropdown = (props) => {
|
||||
return (
|
||||
<Autocomplete
|
||||
id={props.id}
|
||||
options={props.options}
|
||||
getOptionLabel={(option) => (option.name ? option.name : "")}
|
||||
value={props.value}
|
||||
onChange={props.onChange}
|
||||
// Add isOptionEqualToValue prop
|
||||
isOptionEqualToValue={(option, value) => option.name === value}
|
||||
renderInput={(params) => <TextField {...params} label={props.label} />}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
// Define PropTypes for DropDown component
|
||||
Dropdown.propTypes = {
|
||||
id: PropTypes.string.isRequired,
|
||||
label: PropTypes.string.isRequired,
|
||||
options: PropTypes.array.isRequired,
|
||||
onChange: PropTypes.func.isRequired,
|
||||
value: PropTypes.object.isRequired,
|
||||
id: PropTypes.string.isRequired,
|
||||
label: PropTypes.string.isRequired,
|
||||
options: PropTypes.array.isRequired,
|
||||
onChange: PropTypes.func.isRequired,
|
||||
value: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
export default Dropdown;
|
||||
Reference in new issue
Block a user