This is a solution to the REST Countries API with color theme switcher challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.
The challenge was to create an site to consume an API with countries data
Users should be able to:
- See all countries from the API on the homepage
- Search for a country using an
inputfield - Filter countries by region
- Click on a country to see more detailed information on a separate page
- Click through to the border countries on the detail page
- Toggle the color scheme between light and dark mode
I try to create all the interface first, I used JSON Server to fake the data that the API will return. It's a good practive because some API's have limited requests per user.
After the interface I start work in the Contexts, I create three of them. One the theme, one for the data and one for the modal. I decided to do that because I wanna try to work with multiple contexts in the same application.
- Semantic HTML5 markup
- CSS custom properties
- Flexbox
- CSS Grid
- React - JS library
- Styled Components - For styles
I could practice the basics of React with this project, I use hooks and the Context API. It was good oportunity to work with Styled-Components theme feature.
I pretend to improve this project adding Next.js in the near future, SSG will be great because the content practily never changes.
- Frontend Mentor - brGuirra
- LinkedIn - https://www.linkedin.com/in/bruno-guirra-7766b6209/
If you are someone doing this challenge too, this post helped me a lot when I had to create the themes with Styled-Components, could save you some time 😊
