Gatsby: [www/showcase] Improve shadow indicating overscroll

Created on 25 Jul 2018  路  8Comments  路  Source: gatsbyjs/gatsby

The shadow on the right side (indicating there are more content to the right) of https://next.gatsbyjs.org/showcase is currently static and could use an improvement.

For example: the implementation of https://cssreference.io/property/align-content/ (scroll the left sidebar) is close to ideal.

Most helpful comment

Hi @fk. With introduction of React Hooks, I decided to try to solve this once more. Once React Hooks is officially out, and Gatsby supports it (for some reason, I couldn鈥檛 make Hooks work with Gatsby).

Demo: https://gatsby-6735.netlify.com
Source: https://github.com/ryanditjia/playing-with-react-hooks

There are plenty of abstraction opportunities, but I鈥檒l leave this here for now.

All 8 comments

Not sure what you referring to鈥攖he white-to-transparent linear gradient of the "Featured Sites" component horizontal scroller or (which I suppose) the sidebar to the _left_ containing the filter category accordion?

<3 to have a sidebar behavior similar to cssreference.io for the site showcase filter sidebar as well as for the docs/features/tutorial sidebar!

Tinkered with implementing how cssreference.io does it. But since it requires using React ref (to get element鈥檚 scrollTop, scrollLeft, offsetHeight, scrollHeight, etc), plus needing to add container scroll listener + window resize listener, it ended up being unmaintainable. Also it didn鈥檛 work with horizontal scrolling.

This PR uses CSS-only solution taken from here. It adds overflow shadows to the category filter accordion.

There are quirks to this solution, but they aren鈥檛 apparent when implemented here, and I think it looks good!

Will try it on Featured Sites next. Leaving this issue open for now.

Hi @fk. With introduction of React Hooks, I decided to try to solve this once more. Once React Hooks is officially out, and Gatsby supports it (for some reason, I couldn鈥檛 make Hooks work with Gatsby).

Demo: https://gatsby-6735.netlify.com
Source: https://github.com/ryanditjia/playing-with-react-hooks

There are plenty of abstraction opportunities, but I鈥檒l leave this here for now.

Hey @ryanditjia! It's so cool to see you haven't forgotten about this! 馃 馃檹

I'm a hopeful noob when it comes to React-land, but even I've managed to hear about React Hooks. 馃構

That enabled me to not only overhear but also remember a conversation among @jlengstorf and @KyleAMathews talking about them not working in Gatsby鈥擩ason even has a simple example repo up at https://github.com/jlengstorf/gatsby-with-hooks. TL;DR: The issue seems to be an upstream one in react-hot-loader if I got things right: https://github.com/gaearon/react-hot-loader/issues/1088

@ryanditjia @fk a fix was found for Hooks and hot module reloading.

See https://github.com/gatsbyjs/gatsby/issues/9489#issuecomment-434868882 for details. I've updated https://github.com/jlengstorf/gatsby-with-hooks so it's working now as well.

Thanks! I was also able to make it work by wrapping the component with React.memo.

I will send a PR once React Hooks is finalized. Hopefully by then there will be a permanent fix to this issue.

Old issues will be closed after 30 days of inactivity. This issue has been quiet for 20 days and is being marked as stale. Reply here or add the label "not stale" to keep this issue open!

Hey again!

It鈥檚 been 30 days since anything happened on this issue, so our friendly neighborhood robot (that鈥檚 me!) is going to close it.

Please keep in mind that I鈥檓 only a robot, so if I鈥檝e closed this issue in error, I鈥檓 HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.

Thanks again for being part of the Gatsby community!

Was this page helpful?
0 / 5 - 0 ratings