Frontend Challenge #8, NFT Preview Component
Tags: beginners, challenge
Published: 2021-12-14 01:57:16

Follow me as I briefly describe my coding journey to build the NFT Preview component from [Frontend Mentors](https://www.notion.so/NFT-Preview-716b3aef822b4182a46b6c2d73003264#d6fa19405d714072b30041611bbb6dcd). I’m a firm believer in learning in public, sacrificing perfection while learning, and each day improving by 1%. I welcome feedback from anyone and will update the final project as time allows. Frontend Mentors is a online platform that provide front-end challenges that include professional web designs.

The goal is to build this:

![original given design of project](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6mvwf4ug6f5016qse01v.jpg)

## Step 1: Build an empty layout that focuses on a mobile first design
Started with a simple layout that focused on a mobile layout first, then a desktop layout. I’m loving the CSS variables to use colors with a descriptive name.

![simple design that shows sections of a mobile layout](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l2nfrmod3vtnm57robv0.PNG)

## Step 2: Focused on one section at a time
Focused on the top section's styling and structure of the primary image. I still haven't worked on the desktop version.

![Design progress with just the top image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6hfu9n2hgfcvaltyeky4.PNG) 

## Step 3: Focus on styling the final section and adding content
Next step was to update content in the lower section with styling and adding the images based on the design given. Now I worked on the desktop version with a few simple media queries.

![Updated style for the content](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l5itp31zemp4131jd829.PNG) 

## Step 4: Biggest problem was the active state in the project for me
A final step is to add the active state to the project. This included cursor pointers and color changes, but the big one was an image over the primary image. The trick was to have one image with position: absolute, while the other was position: relative, and have a system of hiding one or the other based on the cursor location. 

Here is code that I am proud of. It works with the hover CSS styling to display the eye image when you hover. I’m pretty sure there is a better way to do this but I didn’t want to use a background image. 

![Display show and hide code for the top image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ofd4ewcr0jxybkkf9tow.PNG)

![Short GIF of the active state](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hx3scz2ojhg5htj8prl4.gif)

You can play with the final product [here](https://jcsmileyjr.github.io/NFT-Preview/) and read the code [here](https://github.com/jcsmileyjr/NFT-Preview).

## What I learned
1. The hardest part of this project was doing multiple actions at once to the image section. I needed the active state to change when hovering, the images to be visible stacked on top of each other, and a light blue background color that allows all images to show. A super fun challenge.
2. There is this resource I saw but haven't appreciated til now and it's Google fonts at https://fonts.google.com/. One of my goals in doing these frontend projects is to get better at design and styling. This was a valuable gem to find. 

## Thank you for reading
Thank you for reading my learning journey and if you have tips, please DM me on [Twitter](https://twitter.com/JCSmiley4) or [LinkedIn](https://www.linkedin.com/in/jcsmileyjr/).