Menu update. Use react hooks, not client based script.
This commit is contained in:
1 parent
0f1438e8db
commit
ab577fa263
7 files changed
+94
-156
No files matched your search
@@ -0,0 +1,15 @@
|
||||
import * as React from 'react'
|
||||
import useMedia from 'use-media'
|
||||
|
||||
export type Type = 'phone' | 'tablet' | 'laptop' | 'desktop'
|
||||
|
||||
export function useScreenType(types: Type[]): boolean {
|
||||
const isPhone = useMedia('(max-width: 31.25em)')
|
||||
const [match, setMatch] = React.useState(false)
|
||||
|
||||
React.useEffect(() => {
|
||||
setMatch(isPhone && types.includes('phone'))
|
||||
}, [isPhone])
|
||||
|
||||
return match
|
||||
}
|
||||
Reference in new issue
Block a user