Settings.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import React from "react";
  2. import "./App.css";
  3. function Settings() {
  4. function handleMoveChange(newValue) {
  5. window.localStorage.setItem("autoMoveComma", newValue.target.checked);
  6. }
  7. function handleStartChange(newValue) {
  8. window.localStorage.setItem("allowStartOver", newValue.target.checked);
  9. }
  10. return (
  11. <main>
  12. <h1>Einstellungen</h1>
  13. <form>
  14. <input type="checkbox" id="autoMoveComma" name="autoMoveComma" autoFocus
  15. onChange={(e) => handleMoveChange(e)}
  16. defaultChecked={JSON.parse(window.localStorage.getItem("autoMoveComma"))} />
  17. <label htmlFor="autoMoveComma">Zahlen automatisch ausrichten</label>
  18. <br/>
  19. <input type="checkbox" id="allowStartOver" name="allowStartOver"
  20. onChange={(e) => handleStartChange(e)}
  21. defaultChecked={JSON.parse(window.localStorage.getItem("allowStartOver"))}/>
  22. <label htmlFor="allowStartOver">Fehler ausbessern erlauben</label>
  23. </form>
  24. </main>
  25. );
  26. }
  27. export default Settings;