Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 | 3x 51x 51x 5x 5x 5x 51x 169x 169x | import useLocalStorage from "main/utils/useLocalStorage"; import { Form } from "react-bootstrap"; const GenericDropdown = ({ values, setValue, controlId, label }) => { const [valueState, setValueState] = useLocalStorage(controlId, values[0]); const handleUpdateFieldChange = (event) => { localStorage.setItem(controlId, event.target.value); setValueState(event.target.value); setValue(event.target.value); }; return ( <Form.Group controlId={controlId}> <Form.Label>{label}</Form.Label> <Form.Control as="select" value={valueState} onChange={handleUpdateFieldChange} > {values.map(function (v, i) { const key = `${controlId}-option-${i}`; return ( <option key={key} data-testid={key} value={v}> {v} </option> ); })} </Form.Control> </Form.Group> ); }; export default GenericDropdown; |