-
Notifications
You must be signed in to change notification settings - Fork 981
[Accordion] Support multiple values #527
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
jjenzz
commented
Mar 2, 2021
- Adds support for multiple values
- Toggles items by default (clicking button again will close item)
- To prevent items from closing, consumer now needs to control it
- Updates tests
- Updates stories
9082dc8
to
e199b5f
Compare
e199b5f
to
5410542
Compare
const handleItemClose = React.useCallback( | ||
(itemValue) => setValue((prevValue = []) => prevValue.filter((value) => value !== itemValue)), | ||
[setValue] | ||
); |
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 thought this was a nice example of why it's good to have the callback implementation in the component that provides the context. I have the same context API provided by AccordionSingle
and AccordionMultiple
but they have different handler implementations 👍
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.
Love 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.
This is great! Love the approach!
Left a few minor comments.
const handleItemClose = React.useCallback( | ||
(itemValue) => setValue((prevValue = []) => prevValue.filter((value) => value !== itemValue)), | ||
[setValue] | ||
); |
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.
Love that
Co-authored-by: Benoît Grélard <[email protected]>
# New features Breaking changes are indicated with a 🔥 icon. - Add support for SSR - [Accordion] Support multiple values (#527) 🔥 - [Tabs] Add RTL support (`dir` prop) (#497) - Remove `selector` prop and `data-radix-*` atributes 🔥 # Fixes - [Slider] Fix step rounding issue (#463) - [Presence] Improve `Presence` perf (#465) - Fixed potential issue with overriding attributes in certain primitives # Maintenance - Improved internal context handling - Better package/dependency split