Skip to content

Commit

Permalink
Merge pull request #1148 from securityscorecard/silvioprog@UXD-1633
Browse files Browse the repository at this point in the history
refactor(Center): replace defaultProps property
  • Loading branch information
silvioprog authored Sep 30, 2024
2 parents 542206e + 8f4aaf4 commit 992033c
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/components/layout/Center/Center.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
/**
Expand All @@ -38,8 +38,11 @@ const Center = styled.div
'isTextCentered',
]),
})
.attrs((props) => ({
.attrs<CenterProps>((props) => ({
...props,
gutters: props.gutters ?? SpaceSizes.none,
areChildrenCentered: props.areChildrenCentered ?? false,
isTextCentered: props.isTextCentered ?? false,
className: cls(CLX_LAYOUT, props?.className),
}))<CenterProps>`
box-sizing: content-box;
Expand Down Expand Up @@ -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;

0 comments on commit 992033c

Please sign in to comment.