Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Interactive rating component (made with HTML, CSS, and JS)

Danyal 50

@imRanDan

Desktop design screenshot for the Interactive rating component coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


  • the most difficult component was figuring out how to get the javascript to work. Where you need to click a rating and then have that rating shows up on the thank you page. I ended up with a separate HTML page but changed it all to be on one page and used the hidden class to help hide each page as you move on.

  • In terms of what code I am unsure of & I suppose questions for best practices, Is what I did okay? In terms of making it all on one page and using the hidden class to hide the first page and show the second page and make that work through javascript.

Community feedback

WandoCode 840

@Wandole

Posted

Hey,

You've made a good job I think!

  • the way to show/hide the different sections is good
  • the JS is good too

I have some advices if you want to improve your solution (it's mainly about semantic), in my opinion, I let you decide what is relevant:

  • you should use a form tag to wrap the rating values (your buttons)
  • you should use radio input instead of buttons to get the rating value (it's a unique choice among multiples values). If you never styled radio inputs, you can read that to have an idea of how to do it. It's very usefull and you will use it a lot in future projects.

Also:

  • the user should not be able to display the 'thanks' screen if he have not selected a value before.

In term of best practices:

  • the CSS variables have to be declared in the scope where they will be used (usually all the HTML)==> you should use the :root selector. You can read the begining of that article if you want more informations.
  • your CSS variables are not very reusable. If I give you a 'light themed' design of the same project, you will have to change their name. To avoid that, you can use 'abstract' names, for example:
:root{
   --clr-primary-400: hsl(25, 97%, 53%); // Your orange variable

   --clr-neutral-100: hsl(0, 0%, 100%); // Your white variable
   --clr-neutral-200: hsl(217, 12%, 63%); // Your light-gray variable
   --clr-neutral-300: hsl(217, 12%, 63%); // Your light-gray variable
 ... etc.
}

It's only a detail, but for bigger project with 2 themes (light/dark) for example, it will be usefull maybe!

I hope it will help!

Marked as helpful

1

Danyal 50

@imRanDan

Posted

@Wandole Hi, WandoCode!

Thank you for taking the time to view my project and give feedback. I greatly appreciate it. I'll take a look at the semantics and try the form method! I also appreciate the advice for best practices with CSS and will keep those in mind for future projects :)

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord