Files
yaak-mountain-loop/src-web/hooks/useCommandPalette.tsx
Gregory Schier b0e4ece278 Add command palette (#46)
This PR finished the initial PoC command palette. It currently only
supports switching between requests and workspaces, but can easily be
extended for more.
2024-06-07 21:59:57 -07:00

19 lines
512 B
TypeScript

import { CommandPalette } from '../components/CommandPalette';
import { useDialog } from '../components/DialogContext';
import { useHotKey } from './useHotKey';
export function useCommandPalette() {
const dialog = useDialog();
useHotKey('command_palette.toggle', () => {
dialog.toggle({
id: 'command_palette',
size: 'dynamic',
hideX: true,
vAlign: 'top',
noPadding: true,
noScroll: true,
render: ({ hide }) => <CommandPalette onClose={hide} />,
});
});
}