Skip to content

Commit

Permalink
Summary
Browse files Browse the repository at this point in the history
  • Loading branch information
EuJinnLucaShow committed Nov 7, 2023
1 parent d7e86ae commit 7c54a83
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,8 @@ h2 {
article {
font-family: Tahoma, sans-serif;

}

.country-flag {
margin-top: 5px;
}
7 changes: 7 additions & 0 deletions src/image/flag_of_none.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import SlimSelect from 'slim-select';
import { fetchBreeds, fetchCatByBreed } from './js/cat-api.js';
import iziToast from 'izitoast';
import 'izitoast/dist/css/iziToast.min.css';
import noFlag from './image/flag_of_none.svg'

const select = document.getElementById('breed-select');
const catInfo = document.querySelector('.cat-info');
Expand Down Expand Up @@ -29,7 +30,7 @@ function hideElement(element) {
}

function displayCatInfo(catData) {
const cat = catData[0].breeds[0];
const cat = catData[0].breeds[0];
catInfo.innerHTML = `
<div class="wrapper">
<img class="cat-img" src="${catData[0].url}" alt="Cat Image"/>
Expand All @@ -38,7 +39,7 @@ function displayCatInfo(catData) {
<article><b>Description:</b> ${cat.description}</article><br>
<article><b>Temperament:</b> ${cat.temperament}</article><br>
<article><b>Country:</b> ${cat.origin}</article>
<img src="https://flagsapi.com/${cat.country_code}/shiny/64.png" alt="country code">
<img class="country-flag" src="https://flagsapi.com/${cat.country_code}/shiny/64.png" onerror="src='${noFlag}'" width="64px" alt="country flag">
</div>
</div>
`;
Expand Down

0 comments on commit 7c54a83

Please sign in to comment.