useScreenType replaced with useMobile; hide breadcrumbs on mobile
This commit is contained in:
1 parent
822f1a0535
commit
471d8f4714
4 files changed
+12
-20
No files matched your search
@@ -0,0 +1,5 @@
|
||||
import useMedia from 'use-media'
|
||||
|
||||
export function useMobile(): boolean {
|
||||
return useMedia('(max-width: 31.25em)', false)
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
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