Giter Club home page Giter Club logo

catherineisonline / rest-countries Goto Github PK

View Code? Open in Web Editor NEW
26.0 1.0 4.0 2.03 MB

๐ŸŒŽ REST Countries: A project that interacts with API to provide an in-depth look at different countries. With a color theme switcher feature and the ability to filter and search, you can easily navigate and discover new information.

Home Page: https://restful-countries.vercel.app/

License: MIT License

JavaScript 3.96% HTML 2.73% CSS 34.58% TypeScript 58.73%
countries countries-api front-end-development front-end-mentor frontendmentor frontendmentor-challenge frontendmentor-challenges frontendmentorchallenge rest-api restapi

rest-countries's Introduction

Rest Countries

REST Countries API with color theme switcher

Solution for a challenge from frontendmentor.io.



About The Project

If you're wanting to test your JavaScript skills this is the challenge for you. Use whichever JS framework you prefer and pull data from the REST Countries API. The challenge is to integrate with the REST Countries V2 API to pull country data and display it like in the designs. You can use any JavaScript framework/library on the front end such as React or Vue. You also have complete control over which packages you use to do things like make HTTP requests or style your project.

Users should be able to:

  1. See all countries from the API on the homepage.
  2. Search for a country using an input field.
  3. Filter countries by region.
  4. Click on a country to see more detailed information on a separate page.
  5. Click through to the border countries on the detail page.
  6. Toggle the color scheme between light and dark mode (optional).

I do not have access to the Figma sketch so the design is not pixel-perfect.

Built with

  • Semantic HTML5 markup
  • CSS custom properties
  • Flex
  • Desktop-first workflow
  • React
  • TypeScript
  • Rest Countries API

What I learned

Another fun project to practice React along with API. I have worked with other APIs however mostly with static URLs. This one was a bit harder because I had to change the request depending on the input as well. I am currently working on filtering by region. I did make it work however I had to change some tags to make the options field editable, another new thing I found out recently. Instead of changing it via JS, I tried to change it to list tags but instead, the functionality stopped working. Another hard thing I did not manage yet, is changing country borders. The URL I am getting requests from is giving me country code names instead of full names and I am unsure how to change it back to full names. I also finally started to understand how to use states depending on whether it's a class or function component!

Contribution

This project serves as a project to show off my personal skills. I do not accept any contributions like pull requests to this project however if you have any suggestions or ideas feel free to message me or submit an idea in the discussions. Otherwise, you are free to fork this project and change it for your own purposes.

Useful resources

  1. Figma - Paste your design image to check the size of containers, width, etc.
  2. Perfect Pixel - Awesome Chrome extension that helps you to match the pixels of the provided design.
  3. Rest Countries API - information about countries via a RESTful API
  4. Framer Motion - React library for animations

Acknowledgments

A big thank you to anyone providing feedback on my solution. It definitely helps to find new ways to code and find easier solutions!

rest-countries's People

Contributors

catherineisonline avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

rest-countries's Issues

BUG: not refreshing the results using region filter after text input filter

When is being used the text input filter in conjunction with the region filter the latter will not filter the results if used last.

Tested with:

  • Chrome Version 124.0.6367.156 (Official Build) (64-bit)
  • Edge Version 124.0.2478.80 (Official Build) (64 bit)
  • Opera Version 109.0.5097.68 (64 bit)
  • Firefox Version 125.0.3 (64 bit)

Steps to reproduce the error:

  1. Search any country by name (e.g. "ita")
  2. The results are correctly filtered
  3. Select from the option region input some region (e.g. "Africa")
  4. The results are not filtered according to the region filter. Using the provided example the only country appearing in the page should be "Mauritania".
  5. If you go back to the text input field and add or remove any character the results will be correctly filtered

Same behavior doing similar steps (i.e. switching filtering order):

  1. Start filtering by region (e.g. "Africa")
  2. The results are correctly filtered
  3. Filter the countries by name (e.g. "rita")
  4. The results are not filtered according to the region filter. Using the example "Africa" and "rita" should be appear a list of 2 countries: "Mauritania" and "United Kingdom of Great Britain and Northern Ireland"
  5. If you go back to the text input field and add or remove any character the results will be correctly filtered

BUG: not refreshing results by correcting a search with no results

When correcting a string search that produces no results the page is not updated as expected.

Tested with:

  • Chrome Version 124.0.6367.156 (Official Build) (64-bit)
  • Edge Version 124.0.2478.80 (Official Build) (64 bit)
  • Opera Version 109.0.5097.68 (64 bit)
  • Firefox Version 125.0.3 (64 bit)

Steps to reproduce the error:

  1. Filter countries using a string that for sure does not provide any results ("rits" or "ritaa" should be valid)
  2. While typing results are filtered correctly, and ultimately a blank page is shown
  3. Remove one single character from the string used for filtering out the results.
  4. A blank page, this time with the words "No countries found..." is shown

Will not open another issue because is closely to this but keep in mind that the first time that the search does not produces any results it will be shown a blank page without any text, adding one or more character to that search string will produce the blank page with the text "No countries found...".
Steps to reproduce this last:

  1. Filter the countries by typing "rita"
  2. The correct page with filtered results is shown
  3. Add a single character to the string search
  4. The blank page is shown (without any text)
  5. Repeat the point 3 as many times as you want and you can see that it will be shown the blank page with the text "No countries found..."

Bug: 404 Page Not Found on refreshing a page on gh-pages

When refreshing a page I get a 404 Page Not Found error. This happens because GitHub pages don't support single-page apps. It doesn't have access to front-end routes. You can go back and forth without any issue until you refresh the page. I tested it in Chrome, Safari on iPhone, and MacBook Air M1.

Alt Text

Steps to reproduce the error:

  1. Visit: https://catherineisonline.github.io/rest-countries/
  2. Click on any country to be redirected to the single country page
  3. Refresh the page

I have been researching this for almost a month and have not found any solution yet.

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.