Giter VIP home page Giter VIP logo

rest-countries-api-with-color-theme-switcher's Introduction

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

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 (optional)

Screenshot

Light mode desktop

Light mode mobile

Dark mode desktop

Dark mode mobile

My process

Built with

  • Semantic HTML5 markup
  • CSS custom properties
  • Flexbox
  • CSS Grid
  • Mobile-first workflow
  • Php
  • Js
  • Bootstrap - For styles

What I learned

The filter method iterates over each element (in this case, each country object) in the res array. For each country, it checks if the region property of that country object is equal to the value of selectElement.value. selectElement is assumed to be a reference to an HTML element, and value is the selected value of that element.

So, filterCountries will be a new array containing only the country objects whose region property matches the selected value from the element. const filterByRegion = async () => { const res = await getCountries(); const filterCountries = res.filter(country => country.region === selectElement.value); draw(filterCountries); } Front-end Style Guide Layout The designs were created to the following widths: Mobile: 375px Desktop: 1440px Colors Neutral Dark Blue (Dark Mode Elements): hsl(209, 23%, 22%) Very Dark Blue (Dark Mode Background): hsl(207, 26%, 17%) Very Dark Blue (Light Mode Text): hsl(200, 15%, 8%) Dark Gray (Light Mode Input): hsl(0, 0%, 52%) Very Light Gray (Light Mode Background): hsl(0, 0%, 98%) White (Dark Mode Text & Light Mode Elements): hsl(0, 0%, 100%) Typography Fonts Family: Nunito Sans Weights: 300, 600, 800 Icons Font Awesome

rest-countries-api-with-color-theme-switcher's People

Contributors

ackerman507 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.