(breakpointKey: K)
| 20 | type BreakpointKey = keyof typeof breakpoints; |
| 21 | |
| 22 | export function useBreakpoint<K extends BreakpointKey>(breakpointKey: K) { |
| 23 | const bool = useMediaQuery({ |
| 24 | query: `(min-width: ${breakpoints[breakpointKey]})`, |
| 25 | }); |
| 26 | const capitalizedKey = |
| 27 | breakpointKey[0].toUpperCase() + breakpointKey.substring(1); |
| 28 | type Key = `is${Capitalize<K>}`; |
| 29 | return { |
| 30 | [`is${capitalizedKey}`]: bool, |
| 31 | } as Record<Key, boolean>; |
| 32 | } |
no outgoing calls
no test coverage detected