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

TPAIN22 370

@TPAIN22

Desktop design screenshot for the Interactive rating component coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
1newbie
View challenge

Design comparison


SolutionDesign

Community feedback

@alekseibodeev

Posted

Hi, there 👋 Nice solution!

Here are some thing you can improve:

Accessibility:

  • Ensure all elements have good contranst ratio. It's hard to read text when hovering on rating selection buttons.
  • Rating selection button are not accessible with keyboard only. That's because you use <div> elements which don't have tab index by default. It's more appropriate to use radio buttons here.

React:

  • It's more "reactive" way to control your UI with state, but not with side-effect functions. Instead of touching classNames directly in handler you can use state to update UI. For example:
const App = () => {
 const [isOpen, setIsOpen] = useState(false);

 const submitClickHandler = () => setIsOpen(true);

 return (
   <Wrapper>
     <Button onClick={submitClickHandler}>;
     <HiddenComponent className={isOpen ? "" : "hidden"} />
   </Wrapper>
 );
}

Marked as helpful

0

TPAIN22 370

@TPAIN22

Posted

@alekseibodeev

thanks bro I'll fix it

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