-
Notifications
You must be signed in to change notification settings - Fork 0
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
#386 add tags component #426
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
The functionality is working as intended. I also like that we are able to remove the element from the modal and it removes it from the screen as well.
Just the small eslint fixes and we are good.
const addTag = (tag: string) => { | ||
if (!selectedTags.includes(tag)) { | ||
setSelectedTags([...selectedTags, tag]); | ||
} | ||
setSearchTag(''); | ||
setFilteredTags([]); | ||
}; | ||
|
||
const removeTag = (tag: string) => { | ||
setSelectedTags(selectedTags.filter((item) => item !== tag)); | ||
}; |
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.
To avoid issues with stale state, we should use the snapshot of the most recent state. something like: setSelectedTags((prevTags) ....
}; | ||
|
||
return ( | ||
<div className={styles.modalWrapper}> |
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 the reusable modal here
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.
Can you attach a screenshot of how the UI looks? And also implement it so we can test it if it works as intended.
No description provided.