diff --git a/src/Collapse.tsx b/src/Collapse.tsx index 0504476..e75ec5f 100644 --- a/src/Collapse.tsx +++ b/src/Collapse.tsx @@ -32,6 +32,8 @@ const Collapse = React.forwardRef((props, ref) => defaultActiveKey, onChange, items, + classNames: customizeClassNames, + styles, } = props; const collapseClassName = classNames(prefixCls, className); @@ -73,6 +75,8 @@ const Collapse = React.forwardRef((props, ref) => destroyInactivePanel, onItemClick, activeKey, + classNames: customizeClassNames, + styles, }); // ======================== Render ======================== diff --git a/src/hooks/useItems.tsx b/src/hooks/useItems.tsx index 5c86d02..08317ac 100644 --- a/src/hooks/useItems.tsx +++ b/src/hooks/useItems.tsx @@ -3,7 +3,10 @@ import React from 'react'; import type { CollapsePanelProps, CollapseProps, ItemType } from '../interface'; import CollapsePanel from '../Panel'; -type Props = Pick & +type Props = Pick< + CollapsePanelProps, + 'prefixCls' | 'onItemClick' | 'openMotion' | 'expandIcon' | 'classNames' | 'styles' +> & Pick & { activeKey: React.Key[]; }; @@ -18,6 +21,8 @@ const convertItemsToNodes = (items: ItemType[], props: Props) => { activeKey, openMotion, expandIcon, + classNames: collapseClassNames, + styles, } = props; return items.map((item, index) => { @@ -53,6 +58,8 @@ const convertItemsToNodes = (items: ItemType[], props: Props) => { return ( >; + styles?: Partial>; } export type SemanticName = 'header' | 'title' | 'body' | 'icon'; diff --git a/tests/index.spec.tsx b/tests/index.spec.tsx index 1a078e2..ff5f759 100644 --- a/tests/index.spec.tsx +++ b/tests/index.spec.tsx @@ -871,12 +871,12 @@ describe('collapse', () => { const { container } = render( ,