Changeset View
Changeset View
Standalone View
Standalone View
web/e.cash/pages/_app.js
// Copyright (c) 2023 The Bitcoin developers | // Copyright (c) 2023 The Bitcoin developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
import { useState } from 'react'; | |||||
import { ThemeProvider } from 'styled-components'; | import { ThemeProvider } from 'styled-components'; | ||||
import { ecash, stealth } from '/styles/theme'; | import { ecash } from '/styles/theme'; | ||||
import GlobalCSS from '/styles/global'; | import GlobalCSS from '/styles/global'; | ||||
import { ThemeSwitch } from '/components/atoms'; | |||||
export default function App({ Component, pageProps }) { | export default function App({ Component, pageProps }) { | ||||
const [theme, setTheme] = useState(stealth); | |||||
const HandleThemeChange = () => { | |||||
setTheme(theme === ecash ? stealth : ecash); | |||||
}; | |||||
return ( | return ( | ||||
<ThemeProvider theme={theme}> | <ThemeProvider theme={ecash}> | ||||
<GlobalCSS /> | <GlobalCSS /> | ||||
<Component {...pageProps} /> | <Component {...pageProps} /> | ||||
<ThemeSwitch onClick={HandleThemeChange} /> | |||||
</ThemeProvider> | </ThemeProvider> | ||||
); | ); | ||||
} | } |