Unsplash is one of the best places to find high-quality images online. Over the years, I have used it so much that I decided to contribute my photographs to Unsplash. Inspired by the photos section of Adem Ilter's website. I decided to add a photos page to my site. Let's get started with the planning.
These are the steps we need to follow, one by one. This is not a quick tutorial; we will need to wait for approvals at several stages.
First, define the Unsplash API Key in the env.development file. Additionally, add this to the env.production file or set environment variables in Vercel or other platforms.
I want to display the statistics and photos like in the example website. The following functions will suffice for these purposes. If you want to extend the example, you can refer to the documentation.
Create another folder inside the /app directory and name it photos. Then, create a page.tsx file to list and show the photos and statistics.
We retrieve the data using the getStats() and getPhotos() actions. I created a ParallaxScroll component to enhance the photo gallery display. We will pass the photos array to the ParallaxScroll component, which was created by Manu Arora founder of Acernity UI. One of the best UI component libraries online.
The code is mostly self-explanatory, but I strongly recommend reading the documentation for the Framer Motion library.
Here's how the page looks:
That's all for now. Feel free to email me if you have any questions or need further assistance.
You can view the live page here. The source code is available here. Follow the file names to check the implementation.