Skip to content

almoratalla/REST-Countries-API-with-color-theme-switcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Frontend Mentor - REST Countries API with color theme switcher solution

Design preview for the REST Countries API with color theme switcher coding challenge

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.


Table of contents


Overview

Greetings Everyone! This project is built with React and is made to improve my frontend skills. This challenge is setup by Frontend Mentor. To know more about this challenge, read the challenge.md.

The challenge

Users should be able to:

  • See all countries from the API on the homepage
  • Search for a country using an input field
  • 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 (optional)

Difficulty: Advanced

Screenshot

Screen: 1440x1024 light home desktop 1440x1024 light home desktop screenshot

Screen: 1440x1024 dark home desktop 1440x1024 dark home desktop screenshot

Screen: 1440x1024 light detail desktop 1440x1024 light detail desktop screenshot

Screen: 1440x1024 dark detail desktop 1440x1024 dark detail desktop screenshot

Screen: 375x3305 light home mobile 375x3305 light home mobile screenshot

Screen: 375x3305 dark home mobile 375x3305 dark home mobile screenshot

Screen: 375x985 light detail mobile 375x985 light detail mobile screenshot

Screen: 375x985 dark detail mobile 375x985 dark detail mobile screenshot

Links

My process

Built with

  • React - JS library
  • Semantic HTML5 markup
  • SASS (scss syntax) | Node sass | SCSS Modules
  • Flexbox
  • CSS Grid
  • Mobile-first workflow

What I learned

This project is built using React. I learned through this project to implement theme switcher without relying on states but rather solely on scss and css custom properties to implement theme switching. I implemented node sass within this React project instead of styled components because I was more inclined in separating css/stylesheet codes in a separate file, excluded from the Javascript code.

I've also implemented a modular approach to styling in React where components would access one specific scss style which is tied to its corresponding scss file making it more manageable and structurally organized.

For React, I decided to structure containers separately from components to manage state separately. I also initially wanted to add context api but decided against it when it wasn't needed to transfer state through each component.

Lastly, for sizes relative to the original design, I estimated the sizes by pasting the jpg file into AdobeXD and eyeballed its dimensions.

Continued development

For further development, one of the good things to add in this project is to utilize the rest countries api more and add the other properties from the response that are not included in the design. Also caching may also be implemented if backend will not be applied so that the API would not be recklessly consumed every time a container needs to trigger a fetch update.

Useful resources

Author

Acknowledgments

I tip all the hats in the world for FrontEnd Mentor for giving these challenges. I would also like to thank all the references I used for this project and all resources such as icons that I used in this project. Thank you very much.