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
Showing
26 changed files
with
108 additions
and
118 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
import React from 'react' | ||
import PageWrapper from './src/components/PageWrapper' | ||
import { RootWrapper } from './src/components/RootWrapper' | ||
import { PageWrapper } from './src/components/PageWrapper' | ||
|
||
export const wrapRootElement = ({ element }) => { | ||
return ( | ||
<PageWrapper> | ||
{element} | ||
</PageWrapper> | ||
) | ||
} | ||
export const wrapRootElement = ({ element }) => ( | ||
<RootWrapper> | ||
{element} | ||
</RootWrapper> | ||
) | ||
|
||
export const wrapPageElement = ({ element }) => ( | ||
<PageWrapper> | ||
{element} | ||
</PageWrapper> | ||
) |
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,38 +1,16 @@ | ||
import '../styles/index.css' | ||
import React, { useReducer } from 'react' | ||
import { ThemeProvider } from 'styled-components' | ||
import React from 'react' | ||
import { GlobalStyle } from '../theming/GlobalStyle' | ||
import theme from '../theming/theme' | ||
import { themeContext } from '../theming/context' | ||
import { globalDispatchContext, globalStateContext, globalStateReducer } from './state' | ||
// import useLocalStorage from '../lib/useLocalStorage' | ||
|
||
const PageWrapper = ({ children }) => { | ||
// const [themeId] = useLocalStorage('theme', 'light') | ||
const [state, dispatch] = useReducer(globalStateReducer, { | ||
theme: 'light', | ||
}) | ||
const currentTheme = theme[state.theme] | ||
|
||
export const PageWrapper = ({ children }: { children: any }) => { | ||
const isCapturing = | ||
children.props && | ||
children.props.location && | ||
children.props.location.search.indexOf('capture=1') !== -1 | ||
|
||
return ( | ||
<globalDispatchContext.Provider value={dispatch}> | ||
<globalStateContext.Provider value={state}> | ||
<themeContext.Provider value={currentTheme}> | ||
<ThemeProvider theme={currentTheme}> | ||
<div className={isCapturing ? 'isCapturing' : ''}> | ||
<GlobalStyle isCapturing={isCapturing} /> | ||
{children} | ||
</div> | ||
</ThemeProvider> | ||
</themeContext.Provider> | ||
</globalStateContext.Provider> | ||
</globalDispatchContext.Provider> | ||
<> | ||
<GlobalStyle isCapturing={isCapturing} /> | ||
<div className={isCapturing ? 'isCapturing' : ''}>{children}</div> | ||
</> | ||
) | ||
} | ||
|
||
export default PageWrapper |
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,7 @@ | ||
import React, { ReactNode } from 'react' | ||
import { SwitchableThemeProvider } from '../theming/SwitchableThemeProvider' | ||
import '../styles/index.css' | ||
|
||
export const RootWrapper = ({ children }: { children: ReactNode }) => ( | ||
<SwitchableThemeProvider>{children}</SwitchableThemeProvider> | ||
) |
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
3 changes: 1 addition & 2 deletions
3
website/src/components/components/explorer/ComponentsGridItem.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
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
2 changes: 1 addition & 1 deletion
2
website/src/components/guides/gradients/GradientsIllustrations.js
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
4 changes: 1 addition & 3 deletions
4
website/src/components/guides/patterns/PatternsIllustrations.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
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
Oops, something went wrong.