impress-2020/src/app/App.js

54 lines
1.5 KiB
JavaScript
Raw Normal View History

2020-04-21 20:32:53 -07:00
import React from "react";
import { ApolloProvider } from "@apollo/client";
import { CSSReset, ChakraProvider } from "@chakra-ui/core";
import defaultTheme from "@chakra-ui/theme";
2020-05-10 00:21:04 -07:00
import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
2020-05-18 00:20:48 -07:00
import loadable from "@loadable/component";
2020-04-21 17:49:52 -07:00
import apolloClient from "./apolloClient";
2020-05-18 00:20:48 -07:00
const WardrobePage = loadable(() => import("./WardrobePage"));
const HomePage = loadable(() => import("./HomePage"));
const theme = {
...defaultTheme,
styles: {
...defaultTheme.styles,
global: ({ colorMode, ...rest }) => ({
...defaultTheme.styles.global({ colorMode, ...rest }),
color: colorMode === "light" ? "green.800" : "green.50",
transition: "all 0.25s",
}),
},
};
console.log(defaultTheme.styles.global, defaultTheme.styles);
2020-04-25 23:55:39 -07:00
/**
* App is the entry point of our application. There's not a ton of exciting
* stuff happening here, mostly just setting up some globals and theming!
*
* To really dive into the code, try going down into a page component!
*/
2020-04-21 17:49:52 -07:00
function App() {
return (
2020-05-10 00:21:04 -07:00
<Router>
<ApolloProvider client={apolloClient}>
<ChakraProvider theme={theme}>
2020-05-10 00:21:04 -07:00
<CSSReset />
<Switch>
<Route path="/outfits/new">
<WardrobePage />
</Route>
<Route path="/">
<HomePage />
</Route>
</Switch>
</ChakraProvider>
2020-05-10 00:21:04 -07:00
</ApolloProvider>
</Router>
2020-04-21 17:49:52 -07:00
);
}
export default App;