The main server, and probably only repository in this org.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.4 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. import React, {useState} from "react";
  2. import {Button, CustomInput, FormGroup, Modal, ModalBody, ModalFooter, ModalHeader} from "reactstrap";
  3. import ColorPicker from "../Misc/ColorPicker";
  4. import BrightnessSlider from "../Misc/BrightnessSlider";
  5. function ColorModal({cValue, bValue, pValue, onConfirm, onCancel}) {
  6. const [color, setColor] = useState(cValue);
  7. const [brightness, setBrightness] = useState(bValue);
  8. const [power, setPower] = useState(pValue);
  9. return (
  10. <Modal isOpen={true}>
  11. <ModalHeader>Fargevalg</ModalHeader>
  12. <ModalBody style={{margin: "0 auto"}}>
  13. <FormGroup>
  14. <ColorPicker color={color} onChange={setColor}/>
  15. </FormGroup>
  16. <FormGroup>
  17. <BrightnessSlider brightness={brightness} onChange={setBrightness}/>
  18. </FormGroup>
  19. <FormGroup className="on-switch">
  20. <CustomInput type="switch"
  21. id="switch-power"
  22. name="power"
  23. label={power ? "På" : "Av"}
  24. checked={power}
  25. onChange={e => setPower(e.target.checked)}/>
  26. </FormGroup>
  27. </ModalBody>
  28. <ModalFooter>
  29. <Button color="primary" onClick={() => onConfirm(color, brightness, power)}>Lagre</Button>
  30. {" "}
  31. <Button color="secondary" onClick={onCancel}>Avbryt</Button>
  32. </ModalFooter>
  33. </Modal>
  34. );
  35. }
  36. export default ColorModal;