From e7f47d25f16ca5cda5d07a308245e87b823185b5 Mon Sep 17 00:00:00 2001 From: oreqizer Date: Wed, 29 Nov 2023 09:11:41 +0100 Subject: [PATCH] fix(Layout): remove accidental props pass to Grid --- .../orbit-components/src/Layout/index.tsx | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/packages/orbit-components/src/Layout/index.tsx b/packages/orbit-components/src/Layout/index.tsx index bd8cf156c2..2ba8d04bad 100644 --- a/packages/orbit-components/src/Layout/index.tsx +++ b/packages/orbit-components/src/Layout/index.tsx @@ -15,20 +15,25 @@ const getChildrenProps = (type: Type, key: string) => { return null; }; -const Layout = ({ children, type, dataTest }: Props) => ( - - {React.Children.map(children as React.ReactElement, (item, key) => { - return React.cloneElement(item, { - ...getChildrenProps(type, key.toString()), - ...item.props, - }); - })} - -); +const Layout = ({ children, type, dataTest }: Props) => { + // Removes unwanted props from Grid + const { layoutColumns: _, ...props } = LAYOUT_SETTINGS[type]; + + return ( + + {React.Children.map(children as React.ReactElement, (item, key) => { + return React.cloneElement(item, { + ...getChildrenProps(type, key.toString()), + ...item.props, + }); + })} + + ); +}; export default Layout;