stort/src/pages/testing.tsx

72 lines
1.7 KiB
TypeScript
Raw Normal View History

2024-08-01 01:47:08 +08:00
import { BugReport } from "@mui/icons-material";
2024-08-06 12:39:19 +08:00
import { Box, Button, IconButton, TextField, Typography } from "@mui/material";
2024-08-05 21:03:36 +08:00
import { useRouter } from "next/router";
2024-08-06 12:39:19 +08:00
import { useState } from "react";
2024-08-07 15:04:05 +08:00
import { SettingsItem } from "../components/HeaderBar/Settings/SettingsItem";
import { useSettings } from "../contexts/SettingsContext";
import { testing } from "../lib/testing";
2024-08-01 01:47:08 +08:00
export default function Testing() {
// contexts
2024-08-05 21:03:36 +08:00
const router = useRouter();
const { settings, settingsLoading, updateSettings, resetSettings } = useSettings();
2024-08-05 21:03:36 +08:00
// states
2024-08-06 00:14:02 +08:00
const [text, setText] = useState("");
2024-08-07 15:04:05 +08:00
const [color, setColor] = useState("#000000");
2024-08-01 01:47:08 +08:00
return (
<Box>
2024-08-05 21:03:36 +08:00
<IconButton
onClick={() => {
router.push("/");
}}
>
2024-08-01 01:47:08 +08:00
<BugReport />
</IconButton>
<Button
onClick={() => {
resetSettings();
}}
>
reset settings
</Button>
2024-08-07 15:04:05 +08:00
<Button>update settings</Button>
<Button
onClick={() => {
console.log(settings);
}}
>
log settings
</Button>
<Button
onClick={() => {
console.log(testing());
2024-08-01 01:47:08 +08:00
}}
>
testing
2024-08-01 01:47:08 +08:00
</Button>
2024-08-06 00:14:02 +08:00
<Typography>{text}</Typography>
2024-08-07 15:04:05 +08:00
<SettingsItem
defaultText="#8ab4f8"
description="Accent color"
input={
<TextField
name="accent_color"
onChange={(e) => {
setColor(e.target.value);
}}
sx={{
width: "100%",
}}
size="small"
type="color"
value={color}
variant="standard"
/>
}
/>
2024-08-01 01:47:08 +08:00
</Box>
);
}