Skip to content

Commit

Permalink
feat: add className in productTemplate
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelleXBai committed Jul 23, 2024
1 parent 47331cf commit ad2059b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/components/styles/Theme/ThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ export interface ScrollableAreaTheme {
export interface ProductTemplate {
title?: {
backgroundColor?: string;
className?: string;
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,31 @@ export function ProductTemplateTitle({
}: ProductTemplateTitleProps) {
const { width = 0 } = useViewport();
const theme = useThemeContext();

const titleClass = theme.productTemplate?.title?.className;

console.log('theme', theme);

return (
<ProductTemplateTitleBackground data-automation={dataAutomation} theme={theme}>
<ProductTemplateTitleContainer>
<ProductTemplateTitleInnerContainer className="pt-7 m:pt-9 mx-6 m:mx-0">
{title && (
<Heading as="h1" size={width > breakpoints.phone ? 'h1' : 'h2'} align="center" className="px-8">
{title ? (
<Heading
as="h1"
size={width > breakpoints.phone ? 'h1' : 'h2'}
align="center"
className={`px-8 ${titleClass}`}
>
{title}
</Heading>
)}
) : null}
<ProductTemplateTitleWrapper>
{subtitle && (
{subtitle ? (
<Text as="p" size="lead" align="center" className="mt-4">
{subtitle}
</Text>
)}
) : null}
</ProductTemplateTitleWrapper>
{content}
</ProductTemplateTitleInnerContainer>
Expand Down

0 comments on commit ad2059b

Please sign in to comment.