This is my 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. The project focuses on building a responsive UI that allows users to explore country data with filtering, searching, and theme switching.
Users should be able to:
- See all countries from the API on the homepage
- Search for a country using an
inputfield - 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)
- Solution URL: Add solution URL here
- Semantic HTML5 markup
- CSS custom properties (variables)
- Flexbox
- CSS Grid
- Vanilla JavaScript (modular structure)
- Mobile-first workflow
- REST Countries dataset (data.json)
This project helped me improve my understanding of structuring a real-world frontend application without using a framework. One key thing I learned was how to separate logic into reusable modules instead of writing everything in one file. For example:
export function getCountriesByName(countries, query) {
if (!query || !query.trim()) return countries;
const q = query.trim().toLowerCase();
return countries.filter((country) => {
return (
country.name.toLowerCase().includes(q) ||
(country.capital || '').toLowerCase().includes(q)
);
});
}I also improved my understanding of:
- Managing UI state (search + region filter together)
- Building a custom dropdown instead of relying on
<select>. - Handling theme switching using localStorage
- Structuring CSS into global styles and page-specific styles
- Matching designs pixel-perfectly across desktop and mobile (especially 375px)
In future projects, I want to focus on:
- Improving UI consistency and spacing accuracy
- Writing cleaner and more scalable CSS architecture
- Adding accessibility improvements (ARIA roles, keyboard navigation)
- Frontend Mentor challenge page
- REST Countries API documentation
- CSS Grid and Flexbox documentation on MDN
- Website - Ismail Akande
- Frontend Mentor - @Officialsammy2701
- Twitter - @sammy_2701
This project was built as part of my frontend development practice. Special thanks to Frontend Mentor for providing high-quality, real-world challenges.
