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.
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
Learn more depth of an api, Toggle dark mode and light mode.
This is my favorite journey:
function specificData() {
for (let i = 0; i < country.length; i++) {
const languageCode = Object.keys(country[i].name.nativeName)[0];
const nativeName = country[i].name.nativeName[languageCode].common;
const currenciesCode = Object.keys(country[i].currencies);
const currencies = country[i].currencies[currenciesCode]?.name || '-';
const languages = country[i].languages[languageCode];
return { nativeName, currencies, languages };
}
}
Im curious with using IntersectionObserver for this challenge, i tried a lot of way, but its does not work. Also i don't like the way i code the color theme switcher, it does not look good.
- Frontend Mentor - @RazaqHimawan
- Instagram - @rou_jacksen