@@ -5,6 +5,7 @@ import { getClassName } from '@react-devui/utils';
55import { registerComponentMate } from '../../utils' ;
66import { useComponentConfig , usePrefixConfig } from '../root' ;
77import { DSeparator } from '../separator' ;
8+ import { DCardAction } from './CardAction' ;
89import { DCardContent } from './CardContent' ;
910import { DCardHeader } from './CardHeader' ;
1011
@@ -17,6 +18,7 @@ export interface DCardProps extends React.HTMLAttributes<HTMLDivElement> {
1718const { COMPONENT_NAME } = registerComponentMate ( { COMPONENT_NAME : 'DCard' as const } ) ;
1819export const DCard : {
1920 ( props : DCardProps ) : JSX . Element | null ;
21+ Action : typeof DCardAction ;
2022 Header : typeof DCardHeader ;
2123 Content : typeof DCardContent ;
2224} = ( props ) => {
@@ -45,11 +47,9 @@ export const DCard: {
4547 { children }
4648 { dActions && (
4749 < div className = { `${ dPrefix } card__actions` } >
48- { React . Children . map ( dActions as any [ ] , ( action , index ) => (
50+ { React . Children . map ( dActions , ( action , index ) => (
4951 < >
50- { React . cloneElement ( action , {
51- className : getClassName ( action . props . className , `${ dPrefix } card__action` ) ,
52- } ) }
52+ { action }
5353 { index !== dActions . length - 1 && < DSeparator style = { { margin : 8 } } dVertical > </ DSeparator > }
5454 </ >
5555 ) ) }
@@ -59,5 +59,6 @@ export const DCard: {
5959 ) ;
6060} ;
6161
62+ DCard . Action = DCardAction ;
6263DCard . Header = DCardHeader ;
6364DCard . Content = DCardContent ;
0 commit comments