-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'mobile-updates' into close-icon-mobile
- Loading branch information
Showing
18 changed files
with
61 additions
and
59 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
22 changes: 16 additions & 6 deletions
22
...omponents/mobile/MobileLayoutProvider.tsx → .../src/components/layout/LayoutProvider.tsx
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 |
---|---|---|
@@ -1,43 +1,53 @@ | ||
import type { FC } from 'react'; | ||
import React, { createContext, useContext, useState } from 'react'; | ||
import { useMediaQuery } from '../hooks/useMedia'; | ||
import { BREAKPOINT } from '../../constants'; | ||
|
||
type MobileLayoutContextType = { | ||
type LayoutContextType = { | ||
isMobileMenuOpen: boolean; | ||
setMobileMenuOpen: React.Dispatch<React.SetStateAction<boolean>>; | ||
isMobileAboutOpen: boolean; | ||
setMobileAboutOpen: React.Dispatch<React.SetStateAction<boolean>>; | ||
isMobilePanelOpen: boolean; | ||
setMobilePanelOpen: React.Dispatch<React.SetStateAction<boolean>>; | ||
isDesktop: boolean; | ||
isMobile: boolean; | ||
}; | ||
|
||
const MobileLayoutContext = createContext<MobileLayoutContextType>({ | ||
const LayoutContext = createContext<LayoutContextType>({ | ||
isMobileMenuOpen: false, | ||
setMobileMenuOpen: () => {}, | ||
isMobileAboutOpen: false, | ||
setMobileAboutOpen: () => {}, | ||
isMobilePanelOpen: false, | ||
setMobilePanelOpen: () => {}, | ||
isDesktop: false, | ||
isMobile: false, | ||
}); | ||
|
||
export const MobileLayoutProvider: FC = ({ children }) => { | ||
export const LayoutProvider: FC = ({ children }) => { | ||
const [isMobileMenuOpen, setMobileMenuOpen] = useState(false); | ||
const [isMobileAboutOpen, setMobileAboutOpen] = useState(false); | ||
const [isMobilePanelOpen, setMobilePanelOpen] = useState(false); | ||
const isDesktop = useMediaQuery(`(min-width: ${BREAKPOINT}px)`); | ||
const isMobile = !isDesktop; | ||
|
||
return ( | ||
<MobileLayoutContext.Provider | ||
<LayoutContext.Provider | ||
value={{ | ||
isMobileMenuOpen, | ||
setMobileMenuOpen, | ||
isMobileAboutOpen, | ||
setMobileAboutOpen, | ||
isMobilePanelOpen, | ||
setMobilePanelOpen, | ||
isDesktop, | ||
isMobile, | ||
}} | ||
> | ||
{children} | ||
</MobileLayoutContext.Provider> | ||
</LayoutContext.Provider> | ||
); | ||
}; | ||
|
||
export const useMobileLayoutContext = () => useContext(MobileLayoutContext); | ||
export const useLayout = () => useContext(LayoutContext); |
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
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export const BREAKPOINT_MIN_600 = '(min-width: 600px)'; | ||
export const BREAKPOINT = 600; | ||
export const MEDIA_MIN_BREAKPOINT = `@media (min-width: ${BREAKPOINT}px)`; | ||
export const MOBILE_TRANSITION_DURATION = 300; |
Oops, something went wrong.