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

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

#cypress#react#react-testing-library#sass/scss#typescript
P

@christopher-adolphe

Desktop design screenshot for the Coffeeroasters subscription site coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
3intermediate
View challenge

Design comparison


SolutionDesign

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. šŸ™

Community feedback

P
Daveā€¢ 5,245

@dwhenson

Posted

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

1

P

@christopher-adolphe

Posted

Hi @dwhenson šŸ‘‹

That's a really good catch. I disabled mouse scrolling when the modal is opened but I completed missed that the modal wasn't accessible via the keyboard. I'll definitely have look at those packages and release a fix for that issue.

I'll also have a look at this Joy of React course when it will be available. It sounds interesting as per the description on the website. What is your feedback about it so far ? Would you recommend it ?

Thanks for this helpful review.

Best regards.

1
P
Daveā€¢ 5,245

@dwhenson

Posted

@christopher-adolphe I think Josh will open it up in January for early purchases at a discount (but it won't be finished). His CSS course is 50% off today - grab it if you can!

His courses aren't cheap. But they are really, really good. I learnt a lot on the CSS one, and I already knew quite a bit of CSS (don't worry if you're not a JavaScript developer, I certainly am not!)

For React, I didn't know any React at all before starting, so it's harder for me to comment. But I suspect it'll also be really good. I know from interacting with Josh he is really taking care to make it great.

I have only learnt from that course and have a long way today, but did a couple of React challenges from here the other week, and felt pretty good about that!

If you can afford them, I think both are a really solid investment.

Cheers Dave

0
P

@christopher-adolphe

Posted

@dwhenson The quality of Josh's blog content is great so I can only imagine that same goes for the courses he creates. The price is definitely something that plays against me. Even with purchasing power parity applied, it's not easy to afford for me.

I'll check the course when it's out and take a decision from there.

Thanks again.

Best regards.

0
Travolgi šŸ•ā€¢ 31,460

@denielden

Posted

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

1

P

@christopher-adolphe

Posted

Hi @denielden šŸ‘‹

I really appreciate your comments and thanks for the redirection tip. It's working fine now. šŸ‘

I decided to add this preloading as I mocked an HTTP Get request for the page content. It was a good opportunity for me to try implementing this skeleton loader with React.

As for the Git repository, I completely forgot to change the setting back to public... my bad. You should be able to look into the code by now.

Best regards.

1
Travolgi šŸ•ā€¢ 31,460

@denielden

Posted

@christopher-adolphe it was a pleasure.

Yes, now I see the repository... crazy job! Well done

Best regards :)

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