@@ -6,6 +6,34 @@ import { extractInObject, stylingProps } from '../../../theme/tools/utils';
6
6
import { useHasResponsiveProps } from '../../../hooks/useHasResponsiveProps' ;
7
7
8
8
const supplyPropsToChildren = ( children : any , props : any ) => {
9
+ if ( children . length >= 2 ) {
10
+ const result = [ ] ;
11
+ const firstChild = children [ 0 ] ;
12
+ const firstChildProps = {
13
+ ...firstChild . props . children ,
14
+ borderTopRightRadius : 0 ,
15
+ borderBottomRightRadius : 0 ,
16
+ } ;
17
+ result . push (
18
+ React . cloneElement ( firstChild , firstChildProps , firstChild . props . children )
19
+ ) ;
20
+ for ( let i = 1 ; i < children . length - 1 ; i ++ ) {
21
+ const child = children [ i ] ;
22
+ const newProps = { ...props , borderRadius : '0' } ;
23
+ result . push ( React . cloneElement ( child , newProps , child . props . children ) ) ;
24
+ }
25
+ const lastChild = children [ children . length - 1 ] ;
26
+ const lastChildProps = {
27
+ ...lastChild . props . children ,
28
+ borderTopLeftRadius : 0 ,
29
+ borderBottomLeftRadius : 0 ,
30
+ } ;
31
+ result . push (
32
+ React . cloneElement ( lastChild , lastChildProps , lastChild . props . children )
33
+ ) ;
34
+ return result ;
35
+ }
36
+
9
37
return React . Children . map ( children , ( child : JSX . Element ) => {
10
38
return React . cloneElement ( child , props , child . props . children ) ;
11
39
} ) ;
0 commit comments