From 800c454503548809ae1398b8b2c2eb521000236e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C4=8Curda?= Date: Tue, 31 Dec 2024 12:22:24 +0100 Subject: [PATCH] Feat(web-react): Refactor Footer to set padding via style props #DS-1580 --- .../src/components/Footer/Footer.tsx | 13 +++++++----- .../__tests__/useFooterStyleProps.test.ts | 21 +++++++++++++++++++ .../components/Footer/useFooterStyleProps.ts | 7 +------ 3 files changed, 30 insertions(+), 11 deletions(-) create mode 100644 packages/web-react/src/components/Footer/__tests__/useFooterStyleProps.test.ts diff --git a/packages/web-react/src/components/Footer/Footer.tsx b/packages/web-react/src/components/Footer/Footer.tsx index 3cc45a0ff0..ef358c9754 100644 --- a/packages/web-react/src/components/Footer/Footer.tsx +++ b/packages/web-react/src/components/Footer/Footer.tsx @@ -2,7 +2,7 @@ import classNames from 'classnames'; import React from 'react'; -import { BackgroundColors } from '../../constants'; +import { BackgroundColors, PaddingStyleProps } from '../../constants'; import { useStyleProps } from '../../hooks'; import { SpiritFooterProps } from '../../types'; import { PADDING_BOTTOM, PADDING_TOP } from './constants'; @@ -16,12 +16,15 @@ const defaultStyleProps: Partial = { const Footer = (props: SpiritFooterProps) => { const propsWithDefaults = { ...defaultStyleProps, ...props }; - const { children, backgroundColor, paddingBottom, paddingTop, ...restProps } = propsWithDefaults; - const { classProps } = useFooterStyleProps({ backgroundColor, paddingBottom, paddingTop }); - const { styleProps, props: otherProps } = useStyleProps(restProps); + const { children, backgroundColor, ...restProps } = propsWithDefaults; + const { classProps } = useFooterStyleProps({ backgroundColor }); + const { styleProps, props: otherProps } = useStyleProps(restProps, { + paddingBottom: PaddingStyleProps.paddingBottom, + paddingTop: PaddingStyleProps.paddingTop, + }); return ( -