-
Notifications
You must be signed in to change notification settings - Fork 22
pr for my commits #8
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
base: main
Are you sure you want to change the base?
Conversation
… and by search, and add func of change to dark mode - react actions
Tamir198
left a comment
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.
Good work generally left you some comments
src/components/Country.jsx
Outdated
| return ( | ||
| // TODO: Country component | ||
| <div>Country</div> | ||
| <> |
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.
Destruct your props, you can even do :
const Country = ({name, flag , etc...}) => {
| <input type="text" class="search-input" placeholder="Search for a country..." onInput={()=>props.filterBySearchFunc(event)}/> | ||
| </div> | ||
| <div className={`dropdown-wrapper ${isOpen ? "open" : ""}`}> | ||
| <div className="dropdown-header flex flex-jc-sb flex-ai-c" onClick={openDropDown}> |
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.
Here is a shorter syntax :
<div className={`dropdown-wrapper ${isOpen && "open"}`}>
src/pages/Home.jsx
Outdated
| const matchValue = (country,input) =>{ | ||
| return country.name.toLowerCase().includes(input) || | ||
| country.population.toString().includes(input) || | ||
| country.region.toLowerCase().includes(input) || |
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.
includes is array function so you could do it like this :
const matchValue = (country, input) =>
[country.name, country.population.toString(), country.region, country.capital]
.some(value => value.toLowerCase().includes(input.toLowerCase()));And if you destruct card it will be even shorter
|
|
||
| if (!isDarkMode) { | ||
| document.body.classList.add("dark-theme"); | ||
| } else { |
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 use the second argument of classllist.toggle method to add a condition and make this shorter :
document.body.classList.toggle("dark-theme", !isDarkMode);
adding country cards by import from the jsonData, filter it by region and by search, and add func of change to dark mode - react actions