mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-18 06:49:50 +02:00
Add rename/delete/send to cmd+k
This commit is contained in:
21
src-web/hooks/useToggleCommandPalette.tsx
Normal file
21
src-web/hooks/useToggleCommandPalette.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import { useCallback } from 'react';
|
||||
import { CommandPalette } from '../components/CommandPalette';
|
||||
import { useDialog } from '../components/DialogContext';
|
||||
|
||||
export function useToggleCommandPalette() {
|
||||
const dialog = useDialog();
|
||||
const togglePalette = useCallback(() => {
|
||||
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} />,
|
||||
});
|
||||
}, [dialog]);
|
||||
|
||||
return togglePalette;
|
||||
}
|
||||
Reference in New Issue
Block a user