-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adi countries react api #21
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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}> |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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; | ||
|
There was a problem hiding this comment.
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"> |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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"); | ||
|
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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}/> |
There was a problem hiding this comment.
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
No description provided.