Skip to content

greatmetis/greatmetis-rest-countries-api-with-color-theme-switcher

Repository files navigation

Frontend Mentor - REST Countries API with color theme switcher solution

Design Overview This is a solution to the REST Countries API with color theme switcher challenge on Frontend Mentor.

Table of contents

Note: Delete this note and update the table of contents based on what sections you keep.

Overview

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

Links

Built with

  • Semantic HTML5 markup
  • Tailwind Css - Css framework
  • Mobile-first workflow
  • Vue.js - JS library
  • Vue Router
  • Vue Store

What I learned

The major learnings in this project is Vue Router. I not only know how to use router to navigate a declarative location but I understand how to use router's instance methods which can programmatically link to nested the routes.

Also, I confronted a problem on navigating between views. I found the URL was changed, while the page was not loaded. Fortunately, I found the solution is to add a key prop to router-view (see below for the example) to force load.

<router-view :key="$route.path"/>

Useful resources

  • Stackoverflow - This helped me to avoid redundant navigation on Vue Router. See the code in Component-Header.

  • Common Vue problems - This helpmed me to solve the problem that vue router doesn't reload when navigating between Cards.

Author

Acknowledgments

Big thanks to Front End Mentor provides such a great platform for developers like me.