feat(SW-184): language switcher mobile/desktop functionality
This commit is contained in:
12
hooks/useHandleKeyUp.ts
Normal file
12
hooks/useHandleKeyUp.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
"use client"
|
||||
|
||||
import { useEffect } from "react"
|
||||
|
||||
export function useHandleKeyUp(callback: (event: KeyboardEvent) => void) {
|
||||
useEffect(() => {
|
||||
window.addEventListener("keyup", callback)
|
||||
return () => {
|
||||
window.removeEventListener("keyup", callback)
|
||||
}
|
||||
}, [callback])
|
||||
}
|
||||
Reference in New Issue
Block a user