2022-10-09 23:50:33 +02:00
# Frontend Mentor - Product preview card component solution
2022-10-05 22:32:03 +02:00
2022-10-09 23:50:33 +02:00
This is a solution to the [Product preview card component challenge on Frontend Mentor ](https://www.frontendmentor.io/challenges/product-preview-card-component-GO7UmttRfa ). Frontend Mentor challenges help you improve your coding skills by building realistic projects.
2022-10-05 22:32:03 +02:00
2022-10-09 23:50:33 +02:00
## Table of contents
2022-10-05 22:32:03 +02:00
2022-10-09 23:50:33 +02:00
- [Frontend Mentor - Product preview card component solution ](#frontend-mentor---product-preview-card-component-solution )
- [Table of contents ](#table-of-contents )
- [Overview ](#overview )
- [The challenge ](#the-challenge )
- [Screenshot ](#screenshot )
- [Links ](#links )
- [My process ](#my-process )
- [Built with ](#built-with )
- [Author ](#author )
- [Acknowledgments ](#acknowledgments )
2022-10-05 22:32:03 +02:00
2022-10-09 23:50:33 +02:00
**Note: Delete this note and update the table of contents based on what sections you keep.**
2022-10-05 22:32:03 +02:00
2022-10-09 23:50:33 +02:00
## Overview
2022-10-05 22:32:03 +02:00
2022-10-09 23:50:33 +02:00
### The challenge
2022-10-05 22:32:03 +02:00
2022-10-09 23:50:33 +02:00
Users should be able to:
2022-10-05 22:32:03 +02:00
- View the optimal layout depending on their device's screen size
- See hover and focus states for interactive elements
2022-10-09 23:50:33 +02:00
### Screenshot
2022-10-05 22:32:03 +02:00
2022-10-09 23:50:33 +02:00
![Mobile ](screenshots/mobile.png )
![Mobile Dark ](screenshots/mobile-dark.png )
![Desktop ](screenshots/desktop.png )
![Desktop Dark ](screenshots/desktop-dark.png )
2022-10-05 22:32:03 +02:00
2022-10-09 23:50:33 +02:00
### Links
2022-10-05 22:32:03 +02:00
2022-10-09 23:50:33 +02:00
- Solution URL: [Github ](https://github.com/tarasis/tarasis.github.io/tree/main/projects/FrontendMentor/newbie/product-preview-card-component )
- Live Site URL: [tarasis.github.io ](http://tarasis.github.io/FrontendMentor/newbie/product-preview-card-component )
2022-10-05 22:32:03 +02:00
2022-10-09 23:50:33 +02:00
## My process
2022-10-05 22:32:03 +02:00
2022-10-09 23:50:33 +02:00
Standard for me so far. Set up CSS properties for most things.
Then I built the mobile version of the page.
Made minor changes for the desktop version.
Added a Light/Dark switcher, just to show updating the variables to change the colors.
2022-10-05 22:32:03 +02:00
2022-10-09 23:50:33 +02:00
### Built with
2022-10-05 22:32:03 +02:00
2022-10-09 23:50:33 +02:00
- Semantic HTML5 markup
- CSS custom properties
- Flexbox (for some alignment)
- CSS Grid (just for putting in the middle of the page)
- Mobile-first workflow
2022-10-05 22:32:03 +02:00
2022-10-09 23:50:33 +02:00
## Author
2022-10-05 22:32:03 +02:00
2022-10-09 23:50:33 +02:00
- Website - [Robert McGovern ](https://tarasis.net )
- Frontend Mentor - [@tarasis ](https://www.frontendmentor.io/profile/tarasis )
- Twitter - [@tarasis ](https://www.twitter.com/tarasis )
2022-10-05 22:32:03 +02:00
2022-10-09 23:50:33 +02:00
## Acknowledgments
2022-10-05 22:32:03 +02:00
2022-10-09 23:50:33 +02:00
Two articles gave me the setup for the Light / Dark switcher I've set up. The first by [Musthaq Ahamad ](https://medium.com/@haxzie/dark-and-light-theme-switcher-using-css-variables-and-pure-javascript-zocada-dd0059d72fa2 ) gave the JavaScript, but I didn't want to have it as a sliding button and with using a class for dark mode. For handling that I used ideas from [Luke Lowrey's ](https://lukelowrey.com/css-variable-theme-switcher/ ) implementation, using data attributes.