Skip to content
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

feat(cyclops-ui): Dropdown menu to accept other then just enum fields #620

Conversation

s-vamshi
Copy link
Contributor

@s-vamshi s-vamshi commented Oct 8, 2024

closes #50

πŸ“‘ Description

Dropdown menu to accept other then just enum fields when json key has x-suggestions

βœ… Checks

  • I have tested my code (provide screenshots or screen recordings of a working solution)
  • I have performed a self-review of my code

β„Ή Additional context

screen-capture.15.webm

@s-vamshi s-vamshi requested a review from a team as a code owner October 8, 2024 19:07
@s-vamshi
Copy link
Contributor Author

s-vamshi commented Oct 8, 2024

hey @petar-cvit can you please review this pr in your free time?

@s-vamshi
Copy link
Contributor Author

s-vamshi commented Oct 9, 2024

@quest-bot loot #50

@quest-bot quest-bot bot added the βš”οΈ Quest Tracks quest-bot quests label Oct 9, 2024
Copy link

quest-bot bot commented Oct 9, 2024

Quest PR submitted! image Quest PR submitted!

@s-vamshi, you are attempting to solve the issue and loot this Quest. Will you be successful?


Questions? Check out the docs.

Copy link
Collaborator

@KaradzaJuraj KaradzaJuraj left a comment

Choose a reason for hiding this comment

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

Hey @s-vamshi, I’m having trouble running this code. It seems that mode: ”tags" sends the values as arrays, which breaks on the backend. I would much rather prefer a dropdown that sends a single value instead of an array of one value.

Check an example of Select with a Custom dropdown from AntDesign to get an idea of how you could implement this.

If it makes sense, you can extract it into a separate component (something like SuggestInput.tsx perhaps).

Let me know if you can make it work and if you encounter issues with this approach!

@s-vamshi
Copy link
Contributor Author

Hey @KaradzaJuraj, thanks for the suggestions, I will use custom drop-down in a new component instead of making changes to SelectInput component!

@s-vamshi
Copy link
Contributor Author

Hey @KaradzaJuraj @petar-cvit added a new suggestionInput field using custom dropdown
image

screen-capture.webm

Copy link
Collaborator

@KaradzaJuraj KaradzaJuraj left a comment

Choose a reason for hiding this comment

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

Looks great @s-vamshi! Just one more change and we can add this to the codebase πŸš€

value={newOption}
onChange={(event) => setNewOption(event.target.value)}
onKeyDown={(e) => e.stopPropagation()}
onKeyPress={(e) => e.key === "Enter" && addOptionOnEnter()}
Copy link
Collaborator

Choose a reason for hiding this comment

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

OnKeyPress is deprecated; can you move the functionality to onKeyDown?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hey @KaradzaJuraj, moved the logic to onkeydown!

@s-vamshi
Copy link
Contributor Author

hey @KaradzaJuraj done with the changes!

Copy link
Collaborator

@KaradzaJuraj KaradzaJuraj left a comment

Choose a reason for hiding this comment

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

Awesome! Thanks for picking this up @s-vamshi πŸ™

@KaradzaJuraj KaradzaJuraj merged commit 4a94af9 into cyclops-ui:main Oct 27, 2024
2 checks passed
Copy link

quest-bot bot commented Oct 27, 2024

🧚 @s-vamshi congratulations for completing Quest #50

πŸ’° A reward has been credited to you.

To claim your reward follow the instructions here.

Questions? Check out the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
βš”οΈ Quest Tracks quest-bot quests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dropdown menu to accept other then just enum fields
2 participants