Skip to content

A single-page web app that provides countries' information from the Rest Countries API. Features include a search bar, filtering options, and a dark/light mode toggle for a customizable user experience.

Notifications You must be signed in to change notification settings

AnaCarol2001/CountriesWebsite

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

Overview

The challenge

Users should be able to:

  • See all countries from the REST COUNTRIES 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

Links

  • Live Site URL:

My process

Built with

What I learned

During the development of this project, I gained valuable experience in both UI design and implementing advanced functionalities:

  • Light/dark theme with Tailwind: Learned to implement a responsive light/dark mode using Tailwind's dark variant. I also created a custom hook to toggle themes and persist the user's preference in local storage.
  • Routing & Loader Functions: Explored React Router, following their official tutorial and documentation to implement client-side routing and utilized loader functions to fetch and prepare data for the details country page;
  • URL Params: learned how to work with URL parameters to save the page data state, like the region filter;
  • Combobox pattern: Implemented combobox pattern for an accessible search bar, where the user can navigate it using the keyboard keys and have proper audio description.
  • React ref and React Key events: These concepts were used to implement the keyboard interactions for the search bar.
  • Debounce: utilized the debounce technique to optimize the search input since it reduces the amount of fetch requests;
  • Infinite scroll: Implemented it on the main page to reduce the amount of components, especially image elements, improving performance.
  • React Query: Gained experience using React Query for efficient data fetching and caching, improving the application's performance and state management.

These learnings enriched my skills in creating modern, user-friendly web applications while learning more about performance, accessibility, and state management.

Continued development

This project still has room for improvement, especially in performance. I intend to learn how to preload images in React to reduce the First Contentful Paint and dive deeper into the Combobox pattern to improve accessibility and fix some issues present in the one implemented in this project.

For the following projects, I'll focus on learning more about performance, core vitals, testing, and NextJs.

Useful resources

Author

About

A single-page web app that provides countries' information from the Rest Countries API. Features include a search bar, filtering options, and a dark/light mode toggle for a customizable user experience.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages