Skip to content

aditya-chakraborty/interactive-rating-system

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.

Table of contents

Note: Delete this note and update the table of contents based on what sections you keep.

Overview

The challenge

The challenge is to build out this interactive rating component and get it looking as close to the design as possible. The given design is as follows:

Before Submitting After Submitting

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

Screenshot of Rating Card (Pre Submisison) Screenshot of Rating Card (Post Submission)

Links

My process

Built with

  • React - JS library
  • CSS custom properties
  • Flexbox

What I learned

Some of my major learnings from this project are:

  • Breaking down the UI into smaller components to keep my code as DRY as possible. I separated out the rating buttons into one components that I reused fives times.
    const CircleHighlight = (props) => {
        return (
            <button className='btn__rating' onClick={props.onClick}>{props.rating}</button>
        )
    }

    const ratings = [1, 2, 3, 4, 5].map(rating => {
        return (
            <CircleHighlight onClick={ratingClickHandler} key={rating} rating={rating}/>
        )
    })
  • I learnt a lot of details on how to create a UI with optional elements, like the rating component here.

Author