Skip to content

Conversation

@NoaTaboCode
Copy link

No description provided.

Copy link
Member

@Tamir198 Tamir198 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally don`t use console log

Remove your event listeners after done using them

Hardcoded strings should be inside constants files

countryElement.setAttribute('data-country-name', country.name);

countryElement.innerHTML = `
<div class="country-flag">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not use innerHTML because it is a dangerous method

dropdownHeader.addEventListener('click', toggleDropdown);
document.addEventListener('click', closeDropdownOnClickOutside);
dropdownBody.addEventListener('click', handleRegionSelect);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can wrap this inside a function and call this function

async function displayCountryDetails() {
try {
const urlParams = new URLSearchParams(window.location.search);
const countryName = urlParams.get('country');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should extract this into a service exposing the relevant logic as methods

const loader = document.querySelector('.loader');
if (loader) {
loader.style.display = 'none';
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not style via js, do it with css classes

@NoaTaboCode NoaTaboCode reopened this Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants