-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding support for showing and hiding system ingestion sources Adding a fix Adding lint fixes Adding lint fixes Adding hooks
- Loading branch information
John Joyce
authored and
John Joyce
committed
Jul 18, 2024
1 parent
452b94f
commit 6e7e843
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { useEffect } from 'react'; | ||
|
||
export const useCommandS = (onPress: () => void) => { | ||
useEffect(() => { | ||
const handleKeyDown = (event: KeyboardEvent) => { | ||
if (event.metaKey && event.key === 's') { | ||
event.preventDefault(); | ||
onPress(); | ||
} | ||
}; | ||
window.addEventListener('keydown', handleKeyDown); | ||
return () => { | ||
window.removeEventListener('keydown', handleKeyDown); | ||
}; | ||
}, [onPress]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters