-
Notifications
You must be signed in to change notification settings - Fork 2
Use some sort of multiple select component for Tag input #52
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
Conversation
This component seems useless and I feel like we can go further without it
To improve UX and let user intuitively add multiple tags, this commit contains functionality that allows to add multiple tags by simply clicking Enter button Closes: #46
malor
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.
I like the UX! And you can use not only Enter, but also Space or Tab to separate tags.
Overall looks good to me 👍 Small nits inline.
| syntax: '', // eslint-disable-line react/no-unused-state | ||
| }; | ||
| this.onKeyPress = (e) => { | ||
| if (e.which === 13) { e.preventDefault(); } |
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.
Is there a constant for that? If not let's at least document, that 13 is a keycode of Enter
| } | ||
|
|
||
| onTagAdded(tag) { | ||
| this.setState({ tags: [...this.state.tags, 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.
nit: I think we currently do not enforce it at the API level, but maybe we should prevent duplicates of tags on the same snippet? @ikalnytskyi what do you think?
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.
I think it makes sense. Will you file an issue for API to enforce that?
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.
@ikalnytskyi do you want to reject requests with duplicates with 400 Bad Request? Or just remove the duplicates before actually saving the snippet to the db?
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.
@malor Honestly, I don't have strong opinion here. Both approaches have their own pros and cons. What do you think?
To improve UX and let user intuitively add multiple tags, this commit
contains functionality that allows to add multiple tags by simply
clicking Enter button
Closes: #46