-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
Add ChipInput component #808
Conversation
|
✅ Deploy Preview for asyncapi-studio-design-system ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for modest-rosalind-098b67 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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 some comments.
packages/ui/components/ChipInput.tsx
Outdated
initialChips?: string[]; | ||
initialInputValue?: string; |
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 suggest we add support for the following props:
initialChips?: string[]; | |
initialInputValue?: string; | |
name: string; | |
id: string; | |
className: string; | |
onChange: function; | |
isDisabled: boolean; | |
initialChips?: string[]; | |
initialInputValue?: string; |
packages/ui/components/ChipInput.tsx
Outdated
const [chips, setChips] = useState<string[]>(initialChips); | ||
const [inputValue, setInputValue] = useState<string>(initialInputValue); |
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 state of this component is going to be managed from outside. no state management should be done in the component.
packages/ui/components/ChipInput.tsx
Outdated
|
||
return ( | ||
<div className="flex flex-wrap items-center p-2 bg-gray-900 rounded"> | ||
<div className="w-full text-gray-100 mb-2">Tags</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.
<div className="w-full text-gray-100 mb-2">Tags</div> |
packages/ui/components/ChipInput.tsx
Outdated
}; | ||
|
||
return ( | ||
<div className="flex flex-wrap items-center p-2 bg-gray-900 rounded"> |
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.
based on the design, this component should have a border as well.
@KhudaDad414 Thankyou for the review. I have made the changes 🙂 |
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 some comments.
I also noticed that if I delete the text and press delete again, it doesn't remove the last chip. I was expecting to be able to remove chips with the keyboard.
Also, I should be able to navigate through the chips using the keyboard (tab key) and remove a chip if needed (probably the delete key).
Hope that makes sense. It's looking awesome so far
packages/ui/components/ChipInput.tsx
Outdated
className="p-1 bg-gray-900 text-white rounded outline-none" | ||
placeholder={placeholder} | ||
disabled={isDisabled} | ||
defaultValue={'registr'} |
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 would not default it to this but an empty string. You can then create multiple cases in the design system:
- How it looks with all the defaults
- How it looks with some default text
- How it looks with a custom placeholder
- And so on...
@fmvilas Thank you for the review. 🙂
Definitely makes sense. My bad. I missed these things. About navigating through chips, it's a great point that I missed out on. I use tab a lot to navigate. it just makes it so convenient. |
15cbda8
to
ac1e8b7
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
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.
This is beautiful 👏
Great stuff! 🙌
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.
LGMT!
/rtm |
Related issue(s)
Resolves #753