stort/src/pages/testing.tsx

73 lines
1.8 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";
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-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>
<Button
onClick={() => {
updateSettings({
2024-08-07 12:15:01 +08:00
style: {
dark_mode: false as boolean,
accent_color: "#8ab4f8" as string,
transition_duration: 200 as number,
radius: 8 as number,
window_height: 60 as number,
window_width: 400 as number,
font_family: "monospace" as string,
font_scaling: 100,
},
window: {
minimize_button: true as boolean,
maximize_button: true as boolean,
},
});
}}
>
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-06 12:39:19 +08:00
<TextField rows={10} />
2024-08-01 01:47:08 +08:00
</Box>
);
}