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

REST countries | Redux | Emotion | react-router | accessibility

Pavel B. 270

@Jagholin

Desktop design screenshot for the REST Countries API with color theme switcher coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
  • API
4advanced
View challenge

Design comparison


SolutionDesign

Solution retrospective


This was my first time using Redux for state management(which was clearly an overkill for this small project) and I learned a lot about it. I also learned how to use Playwright for E2E testing. I was already familiar with emotion since I used it in other projects as part of Material UI.

In this project I also tried to implement a combobox control element from scratch following the WAI/ARIA guidelines. Not sure if I did it right, and I certainly will not try to reinvent the wheel next time, but it was a good learning experience.

Another thing I tried to do in this project is to follow Cube CSS methodology for styling. I had some problems figuring out how to do it with Emotion, and in the end I'm not sure if I did a good job with it, hence I'm not adding it to the list of technologies used for this project. I still tried to follow the general idea of Cube CSS to separate layout and styling.

Continued development

As it is right now, the app is completely functional, but there are some things that can be improved in the future. I use Playwright for E2E testing, but I dont have many tests yet. I also use Redux store to save Promises for fetching data, which is not what you supposed to do (and yes I know that it complains about it in the console). But it works and for this particular project it is not a big deal. I looked into using RTK Query for this, but it would be an even bigger overkill for this project and I decided to just leave it as is for now.

Also I think I will redo the styling for this project in the future, to have much more clear and consistent separation of concerns. I'm still trying to figure out how to best do it with tools like Emotion.

Community feedback

@coderdannie

Posted

Hi. Congrats on the completion of this project. An extra features you can add is to store the themes state using browser localstorage so that your site can maintain the theme state even if the page was reload. Right now if I switch to dark mode and reload the web page its switching back to the default theme. Using browser storage to store the theme and accessing the themes based on user preference will prevent this from happening. https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage

Marked as helpful

0

Pavel B. 270

@Jagholin

Posted

@coderdannie I thought about adding this feature, but since it's not something a user would immediately see(it requires page reload to be noticable), I decided to skip it for now.

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