diff --git a/src/index.js b/src/index.js index a07b896..029ea06 100644 --- a/src/index.js +++ b/src/index.js @@ -59,47 +59,49 @@ const App = () => { const parentDir = getParentDirectory(openFilePathname) return ( - - { - handleFileListSelection(parentDir) - }} - > - - Back - - + - - {openFilePathname} - - { - write({ value }) - }} - components={{}} - /> - + { + handleFileListSelection(parentDir) + }} + > + + Back + + + + {openFilePathname} + + { + write({ value }) + }} + components={{}} + /> + + ) } else { return ( @@ -110,7 +112,7 @@ const App = () => { padding: 32, marginLeft: 'auto', marginRight: 'auto', - marginTop: '40px' + // marginTop: 'auto' }} > diff --git a/src/layout.js b/src/layout.js index 3927646..2cfe20b 100644 --- a/src/layout.js +++ b/src/layout.js @@ -1,9 +1,12 @@ import React from 'react' -import { ThemeProvider } from 'theme-ui' -import { theme } from '@blocks/editor' +import { ThemeProvider, ColorMode } from 'theme-ui' +import ThemeSwitcher from './themeSwitcher'; +import theme from './theme' export default ({ children }) => ( + + {children} ) diff --git a/src/theme.js b/src/theme.js new file mode 100644 index 0000000..11be6f3 --- /dev/null +++ b/src/theme.js @@ -0,0 +1,16 @@ +import { theme } from '@blocks/editor' + +export default { + ...theme, + initialColorMode: 'light', + colors: { + ...theme.colors, + background: '#fff', + modes: { + dark: { + ...theme.colors.dark, + background: '#000', + } + } + } +} diff --git a/src/themeSwitcher.js b/src/themeSwitcher.js new file mode 100644 index 0000000..562a2c8 --- /dev/null +++ b/src/themeSwitcher.js @@ -0,0 +1,19 @@ +/** @jsx jsx */ +import { jsx, useColorMode } from 'theme-ui' +import { Sun, Moon } from 'react-feather' + +export default props => { + const [ mode, setMode ] = useColorMode() + + return ( + { + const next = mode === 'dark' ? 'light' : 'dark' + setMode(next) + }} + > + {mode == 'dark' ? : } + + ) +}