Skip to content

Commit 8358c06

Browse files
moving setting the data-component upstream (#14877)
1 parent a91ed29 commit 8358c06

File tree

5 files changed

+9
-19
lines changed

5 files changed

+9
-19
lines changed

dotcom-rendering/src/components/ProductCardButtons.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ const getLabel = (cta: ProductCta): string => {
88

99
export const ProductCardButtons = ({
1010
productCtas,
11-
dataComponent,
1211
}: {
1312
productCtas: ProductCta[];
14-
dataComponent?: string;
1513
}) => (
1614
<>
1715
{productCtas.map((productCta, index) => {
@@ -24,11 +22,6 @@ export const ProductCardButtons = ({
2422
minimisePadding={true}
2523
priority={index === 0 ? 'primary' : 'tertiary'}
2624
fullwidth={true}
27-
dataComponent={
28-
dataComponent
29-
? `${dataComponent}-${index + 1}`
30-
: undefined
31-
}
3225
/>
3326
);
3427
})}

dotcom-rendering/src/components/ProductCardInline.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ export const ProductCardInline = ({
182182

183183
return (
184184
<div
185-
data-component="product-card-inline"
185+
data-component={`product-card-type-inline${
186+
isCardOnly ? '-only' : ''
187+
}`}
186188
css={[
187189
isCardOnly ? productCard : showcaseCard,
188190
shouldShowLeftColCard && !isCardOnly && hideFromWide,
@@ -212,10 +214,7 @@ export const ProductCardInline = ({
212214
)}
213215
</div>
214216
<div css={buttonWrapper}>
215-
<ProductCardButtons
216-
productCtas={productCtas}
217-
dataComponent={'inline-product-card-button'}
218-
/>
217+
<ProductCardButtons productCtas={productCtas} />
219218
</div>
220219
{hasCustomAttributes && (
221220
<div css={customAttributesContainer}>

dotcom-rendering/src/components/ProductCardLeftCol.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,7 @@ export const ProductCardLeftCol = ({
119119
)}
120120
</div>
121121
<div css={buttonContainer}>
122-
<ProductCardButtons
123-
productCtas={productCtas}
124-
dataComponent={'left-col-product-card-button'}
125-
/>
122+
<ProductCardButtons productCtas={productCtas} />
126123
</div>
127124
{customAttributes.length > 0 && (
128125
<div css={customAttributesContainer}>

dotcom-rendering/src/components/ProductLinkButton.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export const ProductLinkButton = ({
5555
fullwidth = false,
5656
minimisePadding = false,
5757
priority = 'primary',
58-
dataComponent = 'in-body-product-link-button',
58+
dataComponent,
5959
}: ProductLinkButtonProps) => {
6060
const cssOverrides: SerializedStyles[] = [
6161
heightAutoStyle,
@@ -74,11 +74,11 @@ export const ProductLinkButton = ({
7474
icon={<SvgArrowRightStraight />}
7575
theme={theme}
7676
data-ignore="global-link-styling"
77-
data-link-name="in body link"
77+
data-component={dataComponent}
78+
data-link-name={`product link button ${priority}`}
7879
data-spacefinder-role="inline"
7980
size={size}
8081
cssOverrides={cssOverrides}
81-
data-component={dataComponent}
8282
>
8383
<span
8484
css={css`

dotcom-rendering/src/lib/renderElement.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,7 @@ export const renderElement = ({
583583
<ProductLinkButton
584584
label={element.label}
585585
url={element.url}
586+
dataComponent={'in-body-product-link-button'}
586587
/>
587588
)}
588589
</>

0 commit comments

Comments
 (0)