import { useEffect, useState } from "react"; import logo_light from "../assets/logo_light_160.png"; import logo_dark from "../assets/logo_dark_160.png"; import { AutoComplete, Button } from "@douyinfe/semi-ui"; import { IconSearch, IconSun, IconMoon } from "@douyinfe/semi-icons"; import { Link } from "react-router-dom"; import { shortcuts } from "../data/shortcuts"; export default function Shortcuts() { const [theme, setTheme] = useState(""); const [value, setValue] = useState(""); const [filteredResult, setFilteredResult] = useState( shortcuts.map((t) => { return t.shortcut; }) ); const handleStringSearch = (value) => { setFilteredResult( shortcuts .filter( (i) => i.shortcut.toLowerCase().includes(value.toLowerCase()) || i.title.toLowerCase().includes(value.toLowerCase()) ) .map((i) => i.shortcut) ); }; useEffect(() => { setTheme(localStorage.getItem("theme")); document.title = "Shortcuts | drawDB"; document.body.setAttribute("class", "theme"); }, [setTheme]); const changeTheme = () => { const body = document.body; const t = body.getAttribute("theme-mode"); if (t === "dark") { if (body.hasAttribute("theme-mode")) { body.setAttribute("theme-mode", "light"); setTheme("light"); } } else { if (body.hasAttribute("theme-mode")) { body.setAttribute("theme-mode", "dark"); setTheme("dark"); } } }; return ( <>
logo
Keyboard shortcuts

} placeholder="Search..." className="w-[80%]" data={filteredResult} value={value} onSearch={(v) => handleStringSearch(v)} emptyContent={
No shortcuts found
} onChange={(v) => setValue(v)} onSelect={() => {}} >
{shortcuts.map((s, i) => (
{s.shortcut}
{s.title}
{s.description && ( <>
{s.description}
)}
))}

© 2024 drawDB - All right reserved.
); }