Merge branch 'fix-typo-drive' into 'main'
[ProtonMail-WebClient.git] / packages / pass / hooks / useSearchShortcut.ts
blob232215877847e61689e2b1e00068c2193a3c316c
1 import { useKeyPress } from '@proton/components';
2 import noop from '@proton/utils/noop';
4 export const useSearchShortcut = DESKTOP_BUILD
5     ? (onTriggered: () => void) => {
6           useKeyPress(
7               (evt) => {
8                   if ((evt.ctrlKey || evt.metaKey) && evt.key === 'f') {
9                       evt.preventDefault();
10                       onTriggered();
11                   }
12               },
13               [onTriggered]
14           );
15       }
16     : noop;