Skip to content

Conversation

@AdiAmar1
Copy link

@AdiAmar1 AdiAmar1 commented Jan 1, 2025

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.

Left you some comments

return (
// TODO: Country component
<div>Country</div>
<div className='country' onClick={onClick}>
Copy link
Member

Choose a reason for hiding this comment

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

Use destruction in here

<li>
<strong>Population: </strong>
<span className='country-population'>{countryData.population}</span>
</li>
Copy link
Member

Choose a reason for hiding this comment

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

Style via css and not via html tags

<div className="dropdown-body">
<ul>
<li data-region="all">All</li>
<li data-region="africa">Africa</li>
Copy link
Member

Choose a reason for hiding this comment

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

Consider change this hardcoded tags into a map function


export const Modal = ({ countryData, onClose }) => {
if (!countryData) return null;

Copy link
Member

Choose a reason for hiding this comment

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

Why would a component return null? Wouldn't it be better to return fallback jsx?

<div className="modal-overlay" onClick={onClose}>
<div className="modal-content" onClick={(e) => e.stopPropagation()}>
{/* <button class="close-button" onclick="closeModal()">X</button> */}
<div className="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.

Remove comment

font-size: 30px;
margin-top: -15px;
color: #333;
margin-bottom: 30px;
Copy link
Member

Choose a reason for hiding this comment

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

Save colors inside variables

}

/* אנימציות */
@keyframes fadeIn {
Copy link
Member

Choose a reason for hiding this comment

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

Never add comments in Hebrew. Or any comment on simple css line

const data= await response.json();

console.log("data fetched");

Copy link
Member

Choose a reason for hiding this comment

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

When merging code to main we don`t want to add console.log

population: country.population,
region: country.region,
capital: country.capital ? country.capital[0] :"N/A",
flag: country.flags.svg,
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 also write it like this :

country.capital?.[0] ?? "N/A",

{selectedCountry&& (
<>
{console.log("Modal is rendering for:", selectedCountry)}
<Modal countryData={selectedCountry} onClose={closeModal}/>
Copy link
Member

Choose a reason for hiding this comment

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

Same here about the comment

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