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

fix(accordion): pass missing dividerProps to Divider #3392

Merged
merged 6 commits into from
Jul 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/many-wasps-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/accordion": patch
---

Pass missing `dividerProps` to Divider (#3390)
19 changes: 19 additions & 0 deletions packages/components/accordion/__tests__/accordion.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -356,4 +356,23 @@ describe("Accordion", () => {
});
expect(input).toHaveValue("aabac");
});

it("should pass dividerProps to divider", () => {
const {getByRole} = render(
<Accordion
dividerProps={{
className: "bg-rose-500",
}}
>
<AccordionItem key="1" data-testid="item-1" title="Accordion Item 1">
Accordion Item 1 description
</AccordionItem>
<AccordionItem key="2" data-testid="item-2" title="Accordion Item 2">
Accordion Item 2 description
</AccordionItem>
</Accordion>,
);

expect(getByRole("separator")).toHaveClass("bg-rose-500");
});
});
3 changes: 2 additions & 1 deletion packages/components/accordion/src/accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const AccordionGroup = forwardRef<"div", AccordionProps>((props, ref) => {
disableAnimation,
handleFocusChanged: handleFocusChangedProps,
itemClasses,
dividerProps,
} = useAccordion({
...props,
ref,
Expand All @@ -45,7 +46,7 @@ const AccordionGroup = forwardRef<"div", AccordionProps>((props, ref) => {
{!item.props.hidden &&
!isSplitted &&
showDivider &&
index < state.collection.size - 1 && <Divider />}
index < state.collection.size - 1 && <Divider {...dividerProps} />}
</Fragment>
);
});
Expand Down