52 lines
2.0 KiB
TypeScript
Raw Normal View History

2021-02-20 01:23:52 +03:30
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import React, { useContext } from 'react';
import List from '@material-ui/core/List';
import ListItem, { ListItemProps } from '@material-ui/core/ListItem';
import ListItemIcon from '@material-ui/core/ListItemIcon';
import ListItemText from '@material-ui/core/ListItemText';
import InboxIcon from '@material-ui/icons/Inbox';
2021-02-20 02:57:52 +03:30
import Brightness6Icon from '@material-ui/icons/Brightness6';
import { ListItemSecondaryAction, Switch } from '@material-ui/core';
2021-02-20 01:23:52 +03:30
import NavBarTitle from '../context/NavbarTitle';
2021-02-20 02:57:52 +03:30
import DarkTheme from '../context/DarkTheme';
2021-02-20 01:23:52 +03:30
function ListItemLink(props: ListItemProps<'a', { button?: true }>) {
// eslint-disable-next-line react/jsx-props-no-spreading
return <ListItem button component="a" {...props} />;
}
export default function Settings() {
const { setTitle } = useContext(NavBarTitle);
setTitle('Settings');
2021-02-20 02:57:52 +03:30
const { darkTheme, setDarkTheme } = useContext(DarkTheme);
2021-02-20 01:23:52 +03:30
return (
<div>
<List component="nav" style={{ padding: 0 }}>
<ListItemLink href="/settings/categories">
<ListItemIcon>
<InboxIcon />
</ListItemIcon>
<ListItemText primary="Categories" />
</ListItemLink>
2021-02-20 02:57:52 +03:30
<ListItem>
<ListItemIcon>
<Brightness6Icon />
</ListItemIcon>
<ListItemText primary="Dark Theme" />
<ListItemSecondaryAction>
<Switch
edge="end"
checked={darkTheme}
onChange={() => setDarkTheme(!darkTheme)}
/>
</ListItemSecondaryAction>
</ListItem>
2021-02-20 01:23:52 +03:30
</List>
</div>
);
}