Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted about 3 years ago

Responsive Rating Card

bem, next, react, sass/scss
Clytax•120
@Clytax
A solution to the Interactive rating component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Here are some questions I have:

  1. did I do responsive design correctly? I added media queries through Sass on individual elements instead of one big media query.

  2. should I have chosen a dynamic width/height for the elements of the rating number?

  3. any feedback is welcome!

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Fluffy Kas•7,655
    @FluffyKas
    Posted about 3 years ago

    Heyo,

    Your solution looks nice! If you allow me though, I have a couple of suggestions:

    1. It's not a good idea to define height on most elements (there are exceptions to this, obviously, but in general it's best avoided as it can cause a lot of issues, like unwanted overflow). If you'd like to have some control over spacing, add some padding to them (or margin, when it's applicable).

    2. For the little star, it would be best to remove the alt text, it's just a decorative image so it shouldn't be announced by screen readers. You could also add an aria-hidden=true to it. Same goes for the other image (the small machine you see when the form is submitted).

    3. It would be more semantic to use checkbox inputs (or the very least buttons, if you can't be bothered with the styling) for the rating numbers.

    4. When no rating is selected, you can't press on the submit button. It's great you paid attention to this but it would be nice if there was some sort of visual indicator that the button is disabled and the form cannot be submitted.

    5. You have a width: 100% and height: 100vh on the app container. Defining width here isn't necessary, it's 100% by default. The height should be swapped for min-height: 100vh, so it's not locked.

    6. You could try using rem instead of pixels. Pixels should mostly be used for setting small details, like box-shadow or border but definitely not widths and font-sizes.

    7. Your rating numbers are a little too spaced out in desktop view I think!

    The structure of your Sass file seems fine btw! In your personal projects, I believe you could structure it as you please. I also tend to add the media queries to each element individually, it's easier to find things that way ^^

    Marked as helpful
  • Raymond Adutwum Agyei•800
    @alosoft
    Posted about 3 years ago

    @Clytax I don't use Sass so I cannot comment on your approach with the media query but I can help make your component responsive when zoomed in and out.

    You can start by removing the height and adding a gap to space the children elements out and also set a width in rem to make the rating element to adjust according to the screen size or zoom level

    .rating{
        width: 30rem;
        height: unset;
        gap: 2rem;
        margin: 1rem;
    }
    
    Marked as helpful
  • Clytax•120
    @Clytax
    Posted about 3 years ago

    Wow, thanks for the amazing feedback! This is really useful and I will try to change some things immediately! I've heard about not setting heights a lot, but I've never been comfortable with it I think it's just something you have to get used to. And I need to get used to rem too, not so sure about that yet but a little research will do it :)

    Thanks again!

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
Frontend Mentor logo

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit all CSS, SCSS and Less files in your repository.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

How does the JavaScript validation report work?

When a solution is submitted, we use eslint to run an automated check on the JavaScript code.

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub