Switch to unified view

a b/src/pages/Settings/Settings.tsx
1
import React, { useState } from 'react';
2
import { Box, Typography, Card, CardContent, Switch, FormGroup, FormControlLabel } from '@mui/material';
3
4
const Settings: React.FC = () => {
5
  const [state, setState] = useState({
6
    darkMode: false,
7
    notifications: true,
8
    autoSave: true
9
  });
10
11
  const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
12
    setState({
13
      ...state,
14
      [event.target.name]: event.target.checked
15
    });
16
  };
17
18
  return (
19
    <Box sx={{ p: 3 }}>
20
      <Typography variant="h4" gutterBottom>
21
        Settings
22
      </Typography>
23
      <Card>
24
        <CardContent>
25
          <FormGroup>
26
            <FormControlLabel
27
              control={
28
                <Switch
29
                  checked={state.darkMode}
30
                  onChange={handleChange}
31
                  name="darkMode"
32
                />
33
              }
34
              label="Dark Mode"
35
            />
36
            <FormControlLabel
37
              control={
38
                <Switch
39
                  checked={state.notifications}
40
                  onChange={handleChange}
41
                  name="notifications"
42
                />
43
              }
44
              label="Enable Notifications"
45
            />
46
            <FormControlLabel
47
              control={
48
                <Switch
49
                  checked={state.autoSave}
50
                  onChange={handleChange}
51
                  name="autoSave"
52
                />
53
              }
54
              label="Auto Save"
55
            />
56
          </FormGroup>
57
        </CardContent>
58
      </Card>
59
    </Box>
60
  );
61
};
62
63
export default Settings;