https://github.com/rajat2502/scrollable-carousel-react
This is a basic carousel built using ReactJS. It fetches images from the Unsplash API and shows them in a carousel that is scrollable using both controls and touch. For gracefully loading images, it uses a placeholder image.
https://github.com/rajat2502/scrollable-carousel-react
carousel-component reactjs unsplash
Last synced: 2 months ago
JSON representation
This is a basic carousel built using ReactJS. It fetches images from the Unsplash API and shows them in a carousel that is scrollable using both controls and touch. For gracefully loading images, it uses a placeholder image.
- Host: GitHub
- URL: https://github.com/rajat2502/scrollable-carousel-react
- Owner: rajat2502
- Created: 2021-07-06T15:03:22.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-07-09T15:38:30.000Z (almost 5 years ago)
- Last Synced: 2026-04-08T16:37:15.954Z (3 months ago)
- Topics: carousel-component, reactjs, unsplash
- Language: JavaScript
- Homepage: https://scrollable-carousel-react.netlify.app/
- Size: 304 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Scrollable Carousel React
This is a basic carousel built using ReactJS. It fetches images from the Unsplash API and shows them in a carousel that is scrollable using both controls and touch. For gracefully loading images, it uses a placeholder image.
**See Hosted Version [here](https://scrollable-carousel-react.netlify.app/)**
### Features
- Carousel is scrollable through **controls** as well as using **touch**.
- Shows **placeholder images** until the actual image is completely loaded in the background.
- Fetch random images as well as images related to a keyword.
- Ability to download the image.
### Technologies Used
- ReactJS (Frontend library)
- Tailwindcss (CSS Framework)
- Unsplash API
- Netlify.com (For Hosting)
### Optimizations Performed:
- **Purging unused CSS**: TailwindCSS comes with a lot of CSS and styles due to which a good amount of classes always remains unused. Using purging reduced the Gzipped CSS size from **450KB** to just **2KB** that reduced the page-load time by 0.6s.
- **Font-Display swap**: The project uses a custom font, which initially blocked the page loading time for some time, used the `font-display: swap` property to load the system font initially, and once the page is loaded then only request the Custom font.
- Used SVGs in place of PNGs/JPEGs.
- Rewritten reusable code and avoided any blocking code.
How to setup locally?
- Fork and clone the repo using
```
$ git clone https://github.com/rajat2502/scrollable-carousel-react
$ cd scrollable-carousel-react
```
- Get a new API key from [https://unsplash.com/documentation](https://unsplash.com/documentation) and replace it with `REACT_APP_UNSPLASH_KEY` in `.env.example`.
- Rename the file `.env.example` to `.env`
- Install node dependencies using
```
$ yarn add
```
- Run Server at localhost using
```
$ yarn serve
```
### Screenshot(s)
