-
Notifications
You must be signed in to change notification settings - Fork 1
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
7 changed files
with
2,488 additions
and
51 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from 'react'; | ||
import { useColorMode } from 'theme-ui'; | ||
|
||
export default function Header() { | ||
const [colorMode, setColorMode] = useColorMode(); | ||
return ( | ||
<header> | ||
<button onClick={() => setColorMode(colorMode === 'light' ? 'dark' : 'light')}> | ||
Toggle {colorMode === 'light' ? 'Dark' : 'Light'} | ||
</button> | ||
</header> | ||
); | ||
} |
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,34 @@ | ||
import React from 'react'; | ||
import App from 'next/app'; | ||
import { ThemeProvider, Styled } from 'theme-ui'; | ||
|
||
import Header from '../components/Header'; | ||
import theme from '../theme'; | ||
|
||
class MyApp extends App { | ||
// Only uncomment this method if you have blocking data requirements for | ||
// every single page in your application. This disables the ability to | ||
// perform automatic static optimization, causing every page in your app to | ||
// be server-side rendered. | ||
// | ||
// static async getInitialProps(appContext) { | ||
// // calls page's `getInitialProps` and fills `appProps.pageProps` | ||
// const appProps = await App.getInitialProps(appContext); | ||
// | ||
// return { ...appProps } | ||
// } | ||
|
||
render() { | ||
const { Component, pageProps } = this.props; | ||
return ( | ||
<ThemeProvider theme={theme}> | ||
<Header /> | ||
<Styled.root as="main"> | ||
<Component {...pageProps} /> | ||
</Styled.root> | ||
</ThemeProvider> | ||
); | ||
} | ||
} | ||
|
||
export default MyApp; |
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,23 @@ | ||
import React from 'react'; | ||
import Document, { Html, Head, Main, NextScript } from 'next/document'; | ||
|
||
class MyDocument extends Document { | ||
static async getInitialProps(ctx) { | ||
const initialProps = await Document.getInitialProps(ctx); | ||
return { ...initialProps }; | ||
} | ||
|
||
render() { | ||
return ( | ||
<Html> | ||
<Head /> | ||
<body> | ||
<Main /> | ||
<NextScript /> | ||
</body> | ||
</Html> | ||
); | ||
} | ||
} | ||
|
||
export default MyDocument; |
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,41 @@ | ||
export default { | ||
useColorSchemeMediaQuery: true, | ||
useCustomProperties: true, | ||
colors: { | ||
text: '#000', | ||
background: '#fff', | ||
primary: '#07c', | ||
secondary: '#609', | ||
modes: { | ||
dark: { | ||
text: '#fff', | ||
background: '#222', | ||
primary: '#0cf', | ||
secondary: '#90c', | ||
}, | ||
}, | ||
}, | ||
fonts: { | ||
body: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif', | ||
heading: 'inherit', | ||
}, | ||
styles: { | ||
root: { | ||
fontFamily: 'body', | ||
color: 'text', | ||
bg: 'background', | ||
}, | ||
h1: { | ||
fontSize: [4, 5, 6], | ||
color: 'primary', | ||
}, | ||
a: { | ||
color: 'primary', | ||
textDecoration: 'none', | ||
':hover': { | ||
color: 'secondary', | ||
textDecoration: 'underline', | ||
}, | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.