From 8f4aaf42077ad815dd8e96eafef7e7020e800119 Mon Sep 17 00:00:00 2001 From: silvioprog Date: Thu, 26 Sep 2024 15:53:38 -0300 Subject: [PATCH] refactor(Center): replace defaultProps property --- src/components/layout/Center/Center.tsx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/components/layout/Center/Center.tsx b/src/components/layout/Center/Center.tsx index 7795f42ed..2e7cb5fbd 100644 --- a/src/components/layout/Center/Center.tsx +++ b/src/components/layout/Center/Center.tsx @@ -14,7 +14,7 @@ export interface CenterProps { */ maxWidth?: number; /** - * Gutters arround content. Gutters are not counted in maximal content width. + * Gutters around content. Gutters are not counted in maximal content width. */ gutters?: SpaceSize; /** @@ -38,8 +38,11 @@ const Center = styled.div 'isTextCentered', ]), }) - .attrs((props) => ({ + .attrs((props) => ({ ...props, + gutters: props.gutters ?? SpaceSizes.none, + areChildrenCentered: props.areChildrenCentered ?? false, + isTextCentered: props.isTextCentered ?? false, className: cls(CLX_LAYOUT, props?.className), }))` box-sizing: content-box; @@ -67,10 +70,4 @@ const Center = styled.div ${({ isTextCentered }) => isTextCentered && `text-align: center;`}; `; -Center.defaultProps = { - gutters: SpaceSizes.none, - areChildrenCentered: false, - isTextCentered: false, -}; - export default Center;