v4iv / gatsby-starter-business

Gatsby Business Website Starter

Home Page:https://gatsby-starter-business.netlify.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Implement floating scroll back to top button

edemirbag opened this issue · comments

Current behaviour: this feature currently does not exist.

Desired behaviour: a back to top button to appear as the user scrolls down the page; when clicked, it will trigger scrolling to the top of the page; button icon should be an SVG (as opposed to an image).

Related links:

Tried most of the above npm modules and getting a lot of build document or window errors.
Playing with Scroll from; =
janosh.io
But it uses React hooks only available in react 16.8.4 so you have to upgrade this repo with the latest Gatsby and React.

codepen link to apoyx uses $ jquery so its out.

The problem is the window event; To Top is using. Gatsby freaks out on window or document.

@edemirbag you are welcome to make a PR, but since this is a non essential feature this is not on the current roadmap

Nailed it Scroll works perfect you can add it if ya like. Might take me some time to get a PR going
View it a publiuslogic.com
repo

Needs
React & React dom 16.8.5

And the Latest
styled-components & styled-icons

Add it to layout
<Scroll showBelow={1500} css='position: fixed; right: 1.5em; bottom: 1em;' />

Great work. Will await the PR!