Skip to content

Austinet/countriesAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Frontend Mentor - REST Countries API with color theme switcher solution

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

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

Screenshot

  • Homepage Large Screen
  • Homepage Large Screen Dark Mode
  • Home page Medium Screen
  • Home page Small Screen
  • Single Country Large Screen
  • Single Country Large Screen Dark Mode
  • Single Country Small Screen
  • Search Feature
  • Filter Feature

Links

My process

Built with

  • Semantic HTML5 markup
  • CSS custom properties
  • Flexbox
  • CSS Grid
  • Desktop-first workflow
  • Vanilla Javascript
  • REST API

What I learned

I learnt a lot while working on this challenge, especially on APIs. I also implemented the search and filter feature beautifully, i was amazed.

Code snippets i was amazed about:

//Search feature
let searchInput = document.getElementById('search')
searchInput.addEventListener('input', () => {
  let searchValue = searchInput.value.toUpperCase()
  let cardsDB = document.querySelectorAll(".cards");

  for(let i = 0; i < cardsDB.length; i++) {
    let countryName = cardsDB[i].querySelector('h2').innerHTML
    if (countryName.toUpperCase().indexOf(searchValue) > -1) {
      cardsDB[i].style.display = ""
    } else {
      cardsDB[i].style.display = "none"
    }
  }
})

let region = document.getElementById("region")
region.addEventListener("input", () => {
  let regionValue = region.value
  let selectedRegion = data.filter(country => country.region == regionValue)
  renderDB(selectedRegion)
})

Continued development

I've gotten a lot of experience while working with web based technologies like HTML, CSS, Bootstrap, and JavaScript. It's time to take on a JavaScript framework/library, and ReactJS it is.

Useful resources

Author

Acknowledgments

I will like to acknowledge God for giving me the grace to be patient with myself while going through the huddles of carrying out this project. And also Frontend mentor, KodeCamp team for this tasks where i got to consume data from APIs.

About

Countries Rest API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published