add other projects

This commit is contained in:
2025-11-04 15:00:49 -03:00
parent 80ff884ceb
commit 0b0ef528df
218 changed files with 58699 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import { throttle } from 'lodash'
import { useEffect } from 'react'
export function useKeyPress(targetKey, callback) {
useEffect(() => {
const onKeyDown = throttle((event) => {
if (event.key === targetKey) {
event.preventDefault()
callback(event)
}
}, 300)
window.addEventListener('keydown', onKeyDown)
return () => {
window.removeEventListener('keydown', onKeyDown)
onKeyDown.cancel?.()
}
}, [targetKey, callback])
return null
}