-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
70c6707
commit 042f83b
Showing
12 changed files
with
149 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { useIsSSR } from "@react-aria/ssr"; | ||
import { useMediaQuery } from "react-responsive"; | ||
|
||
const useBreakpoints = () => { | ||
const isSSR = useIsSSR(); | ||
|
||
// detect screen size | ||
const isXs = useMediaQuery({ query: "(max-width: 649px)" }); | ||
const isSmUp = useMediaQuery({ query: "(min-width: 650px)" }); | ||
const isMdUp = useMediaQuery({ query: "(min-width: 960px)" }); | ||
const isLgUp = useMediaQuery({ query: "(min-width: 1280px)" }); | ||
const isXlUp = useMediaQuery({ query: "(min-width: 1400px)" }); | ||
|
||
// client-side rendering return the actual media query result | ||
// server-side rendering return the default value | ||
return { | ||
isXs: !isSSR && isXs, | ||
isSmUp: !isSSR && isSmUp, | ||
isMdUp: !isSSR && isMdUp, | ||
isLgUp: !isSSR && isLgUp, | ||
isXlUp: !isSSR && isXlUp, | ||
}; | ||
}; | ||
|
||
export default useBreakpoints; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters