ssorallen / gifs-r-us

All the GIFs you'll ever need are at Gifs-R-Us

Home Page:https://ssorallen.github.io/gifs-r-us/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gifs-R-Us 🎉

A GIF browser built on giphy.com's API.

Running locally

The app is built using create-react-app and can be run according to CRA's setup:

  1. yarn install
  2. yarn start

The grid

The grid uses a CSS Grid layout with columns 200px wide and an automatic number of rows 10px tall. Trending and Search pages use fixed-height GIFs so the GIFs are assigned a fix number of rows, rounded up to the nearest 10px, so that the browser can handle the columns as the window is resized.

Data loading

LOOP ->

  1. Trending/Search pages check if scrollY+clientHeight is within offset of bottom of scrollable height
    • Not within offset of bottom? END
  2. Request next block of GIFs starting at offset
  3. Update of offset when fetch returns, triggers start of LOOP

<- END

  • Scroll listener on window starts at top of LOOP
  • Unmounting the page removes scroll listener and cancels any inflight requests

Notes

  • Search and Trending pages ended up being quite similar in their data loading, and ideally could be factored into a common hook and potentially a common reducer and set of actions.

Resources

About

All the GIFs you'll ever need are at Gifs-R-Us

https://ssorallen.github.io/gifs-r-us/

License:MIT License


Languages

Language:TypeScript 90.6%Language:HTML 5.7%Language:CSS 3.7%Language:JavaScript 0.1%