oops, fix bug in Chakra globals

ahh, right, I was overriding their html/body styles! stop doing that 😅
This commit is contained in:
Emi Matchu 2020-09-07 21:11:10 -07:00
parent 901a6b14f0
commit 75ffd813e9

View file

@ -1,7 +1,7 @@
import React from "react"; import React from "react";
import { ApolloProvider } from "@apollo/client"; import { ApolloProvider } from "@apollo/client";
import { Auth0Provider } from "@auth0/auth0-react"; import { Auth0Provider } from "@auth0/auth0-react";
import { CSSReset, ChakraProvider, useColorMode } from "@chakra-ui/core"; import { CSSReset, ChakraProvider } from "@chakra-ui/core";
import defaultTheme from "@chakra-ui/theme"; import defaultTheme from "@chakra-ui/theme";
import { BrowserRouter as Router, Switch, Route } from "react-router-dom"; import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
import loadable from "@loadable/component"; import loadable from "@loadable/component";
@ -19,20 +19,24 @@ const theme = {
...defaultTheme, ...defaultTheme,
styles: { styles: {
...defaultTheme.styles, ...defaultTheme.styles,
global: ({ colorMode, ...rest }) => ({ global: ({ colorMode, ...rest }) => {
...defaultTheme.styles.global({ colorMode, ...rest }), const defaultGlobals = defaultTheme.styles.global({ colorMode, ...rest });
html: { return {
// HACK: Chakra sets body as the relative position element, which is ...defaultGlobals,
// fine, except its `min-height: 100%` doesn't actually work html: {
// unless paired with height on the root element too! ...defaultGlobals.html,
height: "100%", // HACK: Chakra sets body as the relative position element, which is
}, // fine, except its `min-height: 100%` doesn't actually work
body: { // unless paired with height on the root element too!
background: colorMode === "light" ? "white" : "gray.800", height: "100%",
color: colorMode === "light" ? "green.800" : "green.50", },
transition: "all 0.25s", body: {
}, ...defaultGlobals.body,
}), color: colorMode === "light" ? "green.800" : "green.50",
transition: "all 0.25s",
},
};
},
}, },
}; };