From 5e08b4a27b69ff6b7aaed236c1ce65fee59ff69d Mon Sep 17 00:00:00 2001 From: Matthew Revell Date: Tue, 6 Aug 2024 09:10:12 +0100 Subject: [PATCH] feat: use classnames to control styling in template --- .../ProductTemplate/ProductTemplateV2.tsx | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/components/templates/ProductTemplate/ProductTemplate/ProductTemplateV2.tsx b/src/components/templates/ProductTemplate/ProductTemplate/ProductTemplateV2.tsx index 6491789cf..8c007cc45 100644 --- a/src/components/templates/ProductTemplate/ProductTemplate/ProductTemplateV2.tsx +++ b/src/components/templates/ProductTemplate/ProductTemplate/ProductTemplateV2.tsx @@ -8,6 +8,7 @@ import { navbarOpenHeight } from '../../../../constants'; import styled from 'styled-components'; import { useThemeContext } from '../../../styles/Theme'; import { Text } from '../../../..'; +import classnames from 'classnames'; export interface ProductTemplateV2 { titleClassName: string; @@ -17,14 +18,17 @@ export interface ProductTemplateV2 { headingClassName: string; subheadingClassName: string; }; + row?: { + className: string; + }; } -type MaybeHeaderProps = { +type HeaderProps = { title?: React.ReactNode; subtitle?: React.ReactNode; progressBar?: React.ReactNode; }; -const MaybeHeader = ({ title, subtitle, progressBar }: MaybeHeaderProps) => ( +const Header = ({ title, subtitle, progressBar }: HeaderProps) => (
{title} {progressBar} @@ -33,7 +37,7 @@ const MaybeHeader = ({ title, subtitle, progressBar }: MaybeHeaderProps) => ( ); type ProductTemplateProps = React.PropsWithChildren<{ - header?: MaybeHeaderProps; + header?: HeaderProps; className?: string; contentWidth?: 6 | 8 | 10; prevStep?: ReactElement | string; @@ -52,14 +56,22 @@ const HeaderContainer = styled.div` align-items: center; `; -function ProductTemplate({ header, children, contentWidth = 6 }: ProductTemplateProps) { +function ProductTemplate({ header, children }: ProductTemplateProps) { + const theme = useThemeContext(); + + const templateClassName = theme?.productTemplateV2?.row?.className; + return ( - +
- +
{children}