Skip to content

Commit

Permalink
[refactor] gatsby-browser reset
Browse files Browse the repository at this point in the history
  • Loading branch information
suu3 committed Feb 29, 2024
1 parent a7f818f commit ffb9d4a
Showing 1 changed file with 0 additions and 54 deletions.
54 changes: 0 additions & 54 deletions gatsby-browser.tsx
Original file line number Diff line number Diff line change
@@ -1,59 +1,5 @@
import React from "react"
import { AnimatePresence } from "framer-motion"
// custom typefaces
import "@fontsource-variable/montserrat"
import "@fontsource/merriweather"
// normalize CSS across browsers
import "./src/styles/normalize.css"
// custom CSS styles
import "./src/styles/global.css"

// Highlighting for code blocks
import "./src/styles/prism-atom-dark.css"
// import { ReactComponent as Background } from "./static/images/background.svg"

// export const wrapPageElement = ({ element }) => (
// <>
// {/* <Background
// style={{
// position: "fixed",
// top: 0,
// left: 0,
// right: 0,
// margin: "auto",
// zIndex: -1,
// }}
// /> */}

// <AnimatePresence mode="wait">{element}</AnimatePresence>
// </>
// )

// must be on Gatsby v2.28 or later -- previous versions had a bug with getSavedScrollPosition that was resolved with v2.28
// wait until page exit animation has completed before updating scroll position
export const shouldUpdateScroll = ({
routerProps: { location },
getSavedScrollPosition,
}) => {
// transition duration from `layout.js` * 1000 to get time in ms
// const TRANSITION_DELAY = 0.3 * 1000 * 2

// if it's a "normal" route
// if (location.action === "PUSH") {
// window.setTimeout(() => window.scrollTo(0, 0), TRANSITION_DELAY)
// }

// if we used the browser's forwards or back button
// else {
// // breaking change in shouldUpdateScroll browser API hook:
// // https://github.com/gatsbyjs/gatsby/issues/23842
// // looks like they fixed it in Gatsby v. 2.28.1
// // https://github.com/gatsbyjs/gatsby/pull/27384

// const savedPosition = getSavedScrollPosition(location) || [0, 0]

// window.setTimeout(() => window.scrollTo(...savedPosition), TRANSITION_DELAY)
// }

return true
}

0 comments on commit ffb9d4a

Please sign in to comment.