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

Screenshots

Links

My process

Built with

  • Mobile-first workflow
  • Less to Css
  • Iconbuddy

What I learned

I really enjoyed incorporating javascript in this project. It boosted my confidence by giving me some easy wins. I also learned to incorporate the html dialog element.

<dialog open id="dialog">
  <h4 id="dialog-text">Would you like to re-open the element?</h4>
  <button id="re-open" onclick="reOpen()">Yes</button>
</dialog>
addEventListener("click", (e) => {
  var target = e.target;
  rating.forEach((rating) => {
    rating.classList.remove("rates-active");
  });

  if (Object.values(rating).includes(target)) {
    target.classList.add("rates-active");
    globalTarget = target;
  }
});

Continued development

I decided to add a lot of extra features to practice and I am really proud of how the project turned out. I would like to learn more about working with svgs in development.

Useful resources

  • Blackbox AI - To understand concepts and test your code. DO NOT JUST COPY AND PASTE

Author