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(v5): Update Accordion #5517

Merged
merged 1 commit into from
Dec 11, 2020
Merged

feat(v5): Update Accordion #5517

merged 1 commit into from
Dec 11, 2020

Conversation

kyletsang
Copy link
Member

@kyletsang kyletsang commented Nov 12, 2020

https://v5.getbootstrap.com/docs/5.0/components/accordion/

Accordion is now its own dedicated component in v5.

Note: I left the examples for the custom-toggle card-based components just because it's still possible to create them. Might be useful down the line?

Changes:

  • Rewrite component to match new upstream Accordion component
  • Combine AccordionContext and SelectableContext together to simplify and remove null SelectableContext context fix
  • Update docs
  • Update tests

@kyletsang kyletsang added this to In Progress in v5 support via automation Nov 12, 2020
@kyletsang kyletsang marked this pull request as draft November 12, 2020 22:22
@jquense
Copy link
Member

jquense commented Nov 13, 2020

awesome, gonna try and get some time to take a good look at this. Ping me if i forget!

@kyletsang
Copy link
Member Author

Hey @jquense, are you avail to review some of these existing v5 PRs? I got some free time next week, so I can finish up adding the new beta changes once the existing PRs are merged in.

Thanks!

Copy link
Member

@jquense jquense 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, small nit and API thoughts

src/AccordionToggle.tsx Outdated Show resolved Hide resolved
www/src/examples/Accordion/AllCollapse.js Outdated Show resolved Hide resolved
@kyletsang
Copy link
Member Author

New changes:

  • Renamed AccordionToggle to AccordionButton
  • Reduced the markup required for the accordion by combining AccordionHeader with AccordionButton and AccordionBody with AccordionCollapse
  • Removed the need to specify matching eventKeys in the header and body. Now it's passed through AccordionItem using a context, so you only need to declare it once.
<Accordion defaultActiveKey="0">
  <Accordion.Item eventKey="0">
    <Accordion.Header>Accordion Item #1</Accordion.Header>
    <Accordion.Body>Body</Accordion.Body>
  </Accordion.Item>
  <Accordion.Item eventKey="1">
    <Accordion.Header>Accordion Item #2</Accordion.Header>
    <Accordion.Body>Body</Accordion.Body>
  </Accordion.Item>
</Accordion>

@jquense
Copy link
Member

jquense commented Dec 11, 2020

awesome. We've also come full circle to rebuilding the 5 year old Accordion component API from like bootstrap v3

@kyletsang kyletsang merged commit 5acddf3 into bs5-dev Dec 11, 2020
v5 support automation moved this from In Progress to Done Dec 11, 2020
@kyletsang kyletsang deleted the v5-accordion branch December 11, 2020 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
v5 support
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants