Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 19x 19x 93x | import { createContext, useContext } from 'react'
export interface ShellDrawer {
isOpen: boolean
open: () => void
close: () => void
}
// Outside an AppShell (a story, a unit test) the drawer is closed and the calls do nothing.
const CLOSED: ShellDrawer = { isOpen: false, open: () => {}, close: () => {} }
export const ShellDrawerContext = createContext<ShellDrawer>(CLOSED)
// On a phone the rail and sidebar slide in as a drawer; a screen opens it from its header.
export function useShellDrawer(): ShellDrawer {
return useContext(ShellDrawerContext)
}
|