import { Keyboard } from "lucide-react" import { IconButton } from "@/components/ui/button" import { useToggle } from "@uidotdev/usehooks" import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger, } from "./ui/dialog" import useHotKey from "@/hooks/useHotkey" interface ShortcutProps { content: string keys: string[] } function ShortCut(props: ShortcutProps) { const { content, keys } = props return (
{content}
{keys.map((k) => ( // TODO: 优化快捷键显示
{k}
))}
) } const isMac = function () { return /macintosh|mac os x/i.test(navigator.userAgent) } const CmdOrCtrl = () => { return isMac() ? "Cmd" : "Ctrl" } export function Shortcuts() { const [open, toggleOpen] = useToggle(false) useHotKey("h", () => { toggleOpen() }) return ( Hotkeys
) } export default Shortcuts