-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin' into eric/persistent-state
- Loading branch information
Showing
52 changed files
with
343 additions
and
213 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 was deleted.
Oops, something went wrong.
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,24 @@ | ||
import React from 'react' | ||
|
||
type StateContext = boolean | ||
type SetContext = (v: boolean) => void | ||
|
||
const stateContext = React.createContext<StateContext>(false) | ||
const setContext = React.createContext<SetContext>((_: boolean) => {}) | ||
|
||
export function Provider({children}: React.PropsWithChildren<{}>) { | ||
const [state, setState] = React.useState(false) | ||
return ( | ||
<stateContext.Provider value={state}> | ||
<setContext.Provider value={setState}>{children}</setContext.Provider> | ||
</stateContext.Provider> | ||
) | ||
} | ||
|
||
export function useIsDrawerOpen() { | ||
return React.useContext(stateContext) | ||
} | ||
|
||
export function useSetDrawerOpen() { | ||
return React.useContext(setContext) | ||
} |
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,24 @@ | ||
import React from 'react' | ||
|
||
type StateContext = boolean | ||
type SetContext = (v: boolean) => void | ||
|
||
const stateContext = React.createContext<StateContext>(false) | ||
const setContext = React.createContext<SetContext>((_: boolean) => {}) | ||
|
||
export function Provider({children}: React.PropsWithChildren<{}>) { | ||
const [state, setState] = React.useState(false) | ||
return ( | ||
<stateContext.Provider value={state}> | ||
<setContext.Provider value={setState}>{children}</setContext.Provider> | ||
</stateContext.Provider> | ||
) | ||
} | ||
|
||
export function useIsDrawerSwipeDisabled() { | ||
return React.useContext(stateContext) | ||
} | ||
|
||
export function useSetDrawerSwipeDisabled() { | ||
return React.useContext(setContext) | ||
} |
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,21 @@ | ||
import React from 'react' | ||
import {Provider as DrawerOpenProvider} from './drawer-open' | ||
import {Provider as DrawerSwipableProvider} from './drawer-swipe-disabled' | ||
import {Provider as MinimalModeProvider} from './minimal-mode' | ||
|
||
export {useIsDrawerOpen, useSetDrawerOpen} from './drawer-open' | ||
export { | ||
useIsDrawerSwipeDisabled, | ||
useSetDrawerSwipeDisabled, | ||
} from './drawer-swipe-disabled' | ||
export {useMinimalShellMode, useSetMinimalShellMode} from './minimal-mode' | ||
|
||
export function Provider({children}: React.PropsWithChildren<{}>) { | ||
return ( | ||
<DrawerOpenProvider> | ||
<DrawerSwipableProvider> | ||
<MinimalModeProvider>{children}</MinimalModeProvider> | ||
</DrawerSwipableProvider> | ||
</DrawerOpenProvider> | ||
) | ||
} |
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,24 @@ | ||
import React from 'react' | ||
|
||
type StateContext = boolean | ||
type SetContext = (v: boolean) => void | ||
|
||
const stateContext = React.createContext<StateContext>(false) | ||
const setContext = React.createContext<SetContext>((_: boolean) => {}) | ||
|
||
export function Provider({children}: React.PropsWithChildren<{}>) { | ||
const [state, setState] = React.useState(false) | ||
return ( | ||
<stateContext.Provider value={state}> | ||
<setContext.Provider value={setState}>{children}</setContext.Provider> | ||
</stateContext.Provider> | ||
) | ||
} | ||
|
||
export function useMinimalShellMode() { | ||
return React.useContext(stateContext) | ||
} | ||
|
||
export function useSetMinimalShellMode() { | ||
return React.useContext(setContext) | ||
} |
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
Oops, something went wrong.