robosats/frontend/src/components/App.js

50 lines
1.3 KiB
JavaScript
Raw Normal View History

import React, { Component } from "react";
import { render } from "react-dom";
import HomePage from "./HomePage";
import { CssBaseline, IconButton} from "@mui/material";
2022-03-16 13:23:48 +00:00
import { ThemeProvider, createTheme } from '@mui/material/styles';
2022-03-17 15:56:08 +00:00
import UnsafeAlert from "./UnsafeAlert";
import { I18nextProvider } from "react-i18next";
import i18n from "./i18n";
import DarkModeIcon from '@mui/icons-material/DarkMode';
import LightModeIcon from '@mui/icons-material/LightMode';
export default class App extends Component {
constructor(props) {
super(props);
this.state = {
2022-03-16 13:23:48 +00:00
dark: false,
}
}
lightTheme = createTheme({});
2022-03-16 13:23:48 +00:00
darkTheme = createTheme({
palette: {
mode: 'dark',
background: {
default: "#070707"
2022-03-16 13:23:48 +00:00
},
},
});
render() {
return (
<I18nextProvider i18n={i18n}>
<ThemeProvider theme={this.state.dark ? this.darkTheme : this.lightTheme}>
<CssBaseline/>
<IconButton sx={{position:'fixed',right:'0px'}} onClick={()=>this.setState({dark:!this.state.dark})}>
{this.state.dark ? <LightModeIcon/>:<DarkModeIcon/>}
</IconButton>
<UnsafeAlert className="unsafeAlert"/>
<HomePage/>
</ThemeProvider>
</I18nextProvider>
);
}
}
const appDiv = document.getElementById("app");
render(<App />, appDiv);