Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 2 years ago

Coffeeroasters subscription site | React, Unit Tests, End-to-End Tests

cypress, react, react-testing-library, sass/scss, typescript
P
Christopher Adolphe•620
@christopher-adolphe
A solution to the Coffeeroasters subscription site challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Hello frontend friends! 👋

This was long overdue but I finally completed my 4th challenge on Frontend Mentor. 🎉 I have been learning React since the beginning of 2022 and this project was a great opportunity for me to put what I've learnt into practice. Check my readme.md for more details.

Major challenge(s):

  • I decided to use React with Typescript and I had some difficulties in getting the right types for components props.
  • I really wanted to get the real development experience so I added unit tests for the components and end-to-end tests for the order scenarios.
  • I have yet to add unit test for the custom hook.
  • I still have to figure out how to set the redirection properly for a React application on Netlify.

Bonus:

  • I added some form feedback if the user tries to create a plan without selecting any options.
  • I added a skeleton preloader while the page content loads. I always wanted to implement such a feature and therefore I tried to come up with a solution for that using React.

It took me quite a while to complete this challenge because I was going back and forth in the React documentation and best practices. I really enjoyed that and I'm also happy with the result.

Your feedback would be much appreciated.

Thanks in advance. 🙏

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • P
    Dave•5,295
    @dwhenson
    Posted over 2 years ago

    Hi Christopher,

    Lovely, lovely job here! I'm also pretty new to React and have been learning it for a few months so it's nice to find a fellow student.

    I noticed a couple of problems with the final modal 1) Keyboard focus doesn't move there and 2) The body remains scrollable.

    I've been lucky to be an early test on Josh Comeau's Joy of React course and just yesterday did the modal lesson. It can be really hectic, but there's a couple of packages that can basically solve this for you:

    1. react-focus-lock - moves and locks focus to the modal
    2. react-remove-scroll - removes scroll from all other elememts

    I've not tried them on a project but they seem pretty simple to implement and it might be worth giving them a try?

    Cheers Dave

    Marked as helpful
  • Travolgi 🍕•31,300
    @denielden
    Posted over 2 years ago

    Hi Christopher, You did a spectacular job! 😁

    Above all I really like the preload part with the same style as the facebook comments.

    To set up the redirect on Netlify correctly, add a file called _redirects with /* /index.html 200 in the public folder of the react project.

    Note that this redirection should also be done on production sites outside of Netlify but using an .htaccess file instead of _redirects.

    I wanted to peek at your code but I can't find the repository in your git

    Hope this help 😉 and Happy coding!

    Marked as helpful

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 1st-party linked stylesheets, and styles within <style> tags.

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.

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