-
Notifications
You must be signed in to change notification settings - Fork 16
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
(SP:5) Create Chip component #2901
Conversation
9c1d737
to
d982443
Compare
1866d31
to
b981e4c
Compare
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.
Consider adding a space before return
statements, but it's up to you. Also, consider fixing Pavlo's comments. Overall, nice job!
Some issues are weird, most likely due to If they stay after merging - I will make a new bug and fix it already there |
const [isOpen, setIsOpen] = useState(false) | ||
const [selectedOption, setSelectedOption] = useState<string | null>(null) | ||
|
||
const handleSelect = (option: string) => { | ||
setSelectedOption(option) | ||
setIsOpen((prev) => !prev) |
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.
All basic components must be stateless and all logic must be implemented at the level of the parent component (the value and the function to change this value must be passed through props). Here the component is quite limited because handleSelect only changes the behavior of the component itself, but this function can perform more difficult logic (for example, API request, interaction with other components or states, etc.). That is why the component should not have its own state and any other logic,
because now the only thing it can do is simply change the states of isOpen and selectedOption and make the appropriate style changes
Quality Gate passedIssues Measures |
Examples of chips:
About types and props:
Added info to StoryBook
Added tests