start
This commit is contained in:
21
src/components/KeyboardHandler.tsx
Normal file
21
src/components/KeyboardHandler.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import type { JSX } from "solid-js"
|
||||
import { useKeyboardShortcuts } from "../hooks/useKeyboardShortcuts"
|
||||
import type { TabId } from "./Tab"
|
||||
|
||||
type KeyboardHandlerProps = {
|
||||
children?: JSX.Element
|
||||
onTabSelect: (tab: TabId) => void
|
||||
}
|
||||
|
||||
export function KeyboardHandler(props: KeyboardHandlerProps) {
|
||||
useKeyboardShortcuts({
|
||||
onTabNext: () => {
|
||||
props.onTabSelect("discover")
|
||||
},
|
||||
onTabPrev: () => {
|
||||
props.onTabSelect("settings")
|
||||
},
|
||||
})
|
||||
|
||||
return <>{props.children}</>
|
||||
}
|
||||
Reference in New Issue
Block a user