diff --git a/dotcom-rendering/src/components/ProductElement.stories.tsx b/dotcom-rendering/src/components/ProductElement.stories.tsx index d99d4acdd77..aa27e21482c 100644 --- a/dotcom-rendering/src/components/ProductElement.stories.tsx +++ b/dotcom-rendering/src/components/ProductElement.stories.tsx @@ -4,6 +4,7 @@ import { allModes } from '../../.storybook/modes'; import { productImage } from '../../fixtures/manual/productImage'; import { ArticleDesign, ArticleDisplay, Pillar } from '../lib/articleFormat'; import { getNestedArticleElement } from '../lib/renderElement'; +import { extractHeadingText } from '../model/enhanceProductElement'; import type { ProductBlockElement } from '../types/content'; import { ProductElement } from './ProductElement'; @@ -23,7 +24,9 @@ const product = { _type: 'model.dotcomrendering.pageElements.ProductBlockElement', elementId: 'b1f6e8e2-3f3a-4f0c-8d1e-5f3e3e3e3e3e', primaryHeadingHtml: 'Best Kettle overall', + primaryHeadingText: extractHeadingText('Best Kettle overall'), secondaryHeadingHtml: 'Bosch Sky Kettle', + secondaryHeadingText: extractHeadingText('Bosch Sky Kettle'), brandName: 'Bosch', productName: 'Sky Kettle', image: productImage, @@ -296,7 +299,9 @@ export const WithoutHeading = { product: { ...product, primaryHeadingHtml: '', + primaryHeadingText: '', secondaryHeadingHtml: '', + secondaryHeadingText: '', }, }, } satisfies Story; @@ -316,6 +321,7 @@ export const NoSecondaryHeading = { ...product, primaryHeadingHtml: 'Primary heading only', secondaryHeadingHtml: '', + secondaryHeadingText: '', }, }, } satisfies Story; @@ -325,6 +331,7 @@ export const NoPrimaryHeading = { product: { ...product, primaryHeadingHtml: '', + primaryHeadingText: '', secondaryHeadingHtml: 'Secondary heading only', }, }, diff --git a/dotcom-rendering/src/components/ProductElement.tsx b/dotcom-rendering/src/components/ProductElement.tsx index 7a465580254..fa4f901589b 100644 --- a/dotcom-rendering/src/components/ProductElement.tsx +++ b/dotcom-rendering/src/components/ProductElement.tsx @@ -2,12 +2,11 @@ import { css } from '@emotion/react'; import { from } from '@guardian/source/foundations'; import type { ReactNode } from 'react'; import type { ArticleFormat } from '../lib/articleFormat'; -import { parseHtml } from '../lib/domUtils'; import type { NestedArticleElement } from '../lib/renderElement'; import type { ProductBlockElement } from '../types/content'; import { ProductCardInline } from './ProductCardInline'; import { ProductCardLeftCol } from './ProductCardLeftCol'; -import { buildElementTree } from './SubheadingBlockComponent'; +import { Subheading } from './Subheading'; const contentContainer = css` position: relative; @@ -86,23 +85,10 @@ const Content = ({ const showLeftCol = product.displayType === 'InlineWithProductCard' && shouldShowLeftColCard; - const subheadingHtml = parseHtml( - `