diff --git a/gatsby-ssr.js b/gatsby-ssr.js index 33c7ee9..b17b8fc 100644 --- a/gatsby-ssr.js +++ b/gatsby-ssr.js @@ -1,31 +1,7 @@ -import React from "react" +/** + * Implement Gatsby's SSR (Server Side Rendering) APIs in this file. + * + * See: https://www.gatsbyjs.org/docs/ssr-apis/ + */ -const ThemeScript = () => { - const themeScript = ` -(function() { - function getInitialTheme() { - const userSetTheme = window.localStorage.getItem("theme") - const prefersLightTheme = window.matchMedia( - "(prefers-color-scheme: light)" - ) - - if (userSetTheme && userSetTheme !== '"unset"') return userSetTheme - else if (prefersLightTheme.matches === true) return "light" - else return "dark" - } - - if (typeof document === "undefined") return; - - document.documentElement.style.setProperty( - "--initial-theme", - getInitialTheme() - ) -})() - ` - - return