-
Notifications
You must be signed in to change notification settings - Fork 317
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 support for accordion component #291
Conversation
adirhaz1z
commented
Oct 21, 2021
const children = useMemo(() => { | ||
const allChildren = React.Children.toArray(originalChildren); | ||
return allChildren.filter(child => { | ||
if (child.type.isAccordionChild) return true; |
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.
why not instance of check?
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.
Same thing done in Menu
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.
Did you mean to isSubMenu? That is a different case because in that case, we use the same component for the menu and the submenu - here, we are using different components
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.
Greate pr! I wrote some notes :)
30c32c8
to
33c6ef8
Compare
children: null, | ||
defaultIndex: [] | ||
}; | ||
|
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.
Beautiful component! And using the Accordion Item as children instead of an object is awesome! :)
src/components/Accordion/Accordion/__stories__/accordion.stories.js
Outdated
Show resolved
Hide resolved
|
||
const toogleExpand = () => { | ||
setIsOpen(!isOpen); | ||
}; | ||
const renderHeader = useCallback(() => { |
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.
Yay!
9b4d2c9
to
4948a56
Compare
…to adir/accordion