Skip to content

Dr-Wrong-Mo/fem__interactive-rating-component

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Frontend Mentor - Interactive rating component solution

This is a solution to the Interactive rating component challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.

Table of contents

Overview

The challenge

Users should be able to:

  • View the optimal layout for the app depending on their device's screen size
  • See hover states for all interactive elements on the page
  • Select and submit a number rating
  • See the "Thank you" card state after submitting a rating

Screenshot

Links

My process

I considered a few different approaches to the rating buttons. I knew they needed to be clickable buttons that would change state when they were clicked and keep that state until the form was submitted, or another rating was selected. Instead of using a div and adding an event listener to it, I used something that has the behavior I wanted out of the box. Radio buttons. I needed to do some extra CSS work to get the style the way I wanted, but I think this saved me a lot of JavaScript work.

Built with

  • Semantic HTML5 markup
  • CSS custom properties
  • Flexbox
  • Desktop-first workflow

What I learned

With CSS, I had not previously targeted elements that had a specific data attribute value. In this case, I needed to target a radio button that was checked. In this case, I didn't want to change the values of the radio button itself. Instead, I needed to alter the style on the sibling. Here's what that looked like:

input[type='radio']:checked + label {
  background-color: var(--light-grey);
  color: var(--white);
}

Author

About

This is a project from a Front End Mentor design challenge.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published