import { h, render, Component } from "preact";
import Router from "preact-router";
import AsyncRoute from "preact-async-route";
import { ThemeProvider } from "@material-ui/core/styles";
import CssBaseline from "@material-ui/core/CssBaseline";
import Background from "./Background"
import Home from "./Home";
import theme from "./theme";
import "fontsource-roboto";

class App extends Component {
  render() {
    return (
      <ThemeProvider theme={theme}>
        <CssBaseline />
        <Router>
          <Home path="/" />
          <AsyncRoute path="/contact" getComponent={() =>
            import("./Contact").then((module) => module.default)
          }
          />
          <AsyncRoute path="/ramble" getComponent={() =>
            import("./Ramble").then((module) => module.default)
          }
          />
          <AsyncRoute path="/monq" getComponent={() =>
            import("./Monq").then((module) => module.default)
          }
          />
          <AsyncRoute path="/uni-graphics" getComponent={() =>
            import("./UniGraphics").then((module) => module.default)
          }
          />
          <AsyncRoute path="/graphics-blog" getComponent={() =>
            import("./GraphicsBlog").then((module) => module.default)
          }
          />
          <AsyncRoute default getComponent={() =>
            import("./404Page").then((module) => module.default)
          }
          />
        </Router>
        <Background />
      </ThemeProvider>
    );
  }
}

render(<App />, document.body);
