mirror of
https://github.com/gabehf/Koito.git
synced 2026-03-17 11:16:35 -07:00
chore: initial public commit
This commit is contained in:
commit
fc9054b78c
250 changed files with 32809 additions and 0 deletions
29
client/app/components/sidebar/SidebarSettings.tsx
Normal file
29
client/app/components/sidebar/SidebarSettings.tsx
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import { Settings2 } from "lucide-react";
|
||||
import SettingsModal from "../modals/SettingsModal";
|
||||
import SidebarItem from "./SidebarItem";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
interface Props {
|
||||
size: number
|
||||
}
|
||||
|
||||
export default function SidebarSettings({ size }: Props) {
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const handleKeyDown= (e: KeyboardEvent) => {
|
||||
if (e.key === '\\' && !open) {
|
||||
e.preventDefault();
|
||||
setOpen(true);
|
||||
}
|
||||
};
|
||||
document.addEventListener('keydown', handleKeyDown);
|
||||
return () => document.removeEventListener('keydown', handleKeyDown);
|
||||
}, [open]);
|
||||
|
||||
return (
|
||||
<SidebarItem space={30} keyHint="\" name="Settings" onClick={() => setOpen(true)} modal={<SettingsModal open={open} setOpen={setOpen} />}>
|
||||
<Settings2 size={size} />
|
||||
</SidebarItem>
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue