Files
yaak/src-web/hooks/useCommandPalette.tsx
Gregory Schier 6215914212 Cmd Palette Improvements (#50)
- Fuzzy matching
- Show hotkeys
- Add actions
2024-06-10 21:37:41 -07:00

20 lines
569 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,
className: '!max-h-[min(30rem,calc(100vh-4rem))]',
vAlign: 'top',
noPadding: true,
noScroll: true,
render: ({ hide }) => <CommandPalette onClose={hide} />,
});
});
}