Skip to content

Commit

Permalink
fix(accordion): pass missing dividerProps to Divider (#3392)
Browse files Browse the repository at this point in the history
* chore(deps): pnpm-lock.yaml

* fix(accordion): pass missing `dividerProps` to Divider

* chore(changeset): add issue number

---------

Co-authored-by: WK Wong <wingkwong.code@gmail.com>
  • Loading branch information
chirokas and wingkwong authored Jul 6, 2024
1 parent 35e709d commit 8dce94e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
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

0 comments on commit 8dce94e

Please sign in to comment.