Skip to content

Commit a40b0e6

Browse files
add data component to ProductLinkButton (#14565)
Add data component to ProductLinkButton Co-authored-by: Charley Campbell 115992455+charleycampbell@users.noreply.github.com Co-authored-by: Emma Imber 108270776+emma-imber@users.noreply.github.com Co-authored-by: George Haberis george.haberis@guardian.co.uk
1 parent 842877d commit a40b0e6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

dotcom-rendering/src/components/ProductLinkButton.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
type ProductLinkButtonProps = {
99
label: string;
1010
url: string;
11+
dataComponent?: string;
1112
};
1213

1314
const linkButtonStyles = css`
@@ -19,7 +20,11 @@ const linkButtonStyles = css`
1920
overflow-wrap: break-word;
2021
`;
2122

22-
export const ProductLinkButton = ({ label, url }: ProductLinkButtonProps) => {
23+
export const ProductLinkButton = ({
24+
label,
25+
url,
26+
dataComponent = 'in-body-product-link-button',
27+
}: ProductLinkButtonProps) => {
2328
return (
2429
<LinkButton
2530
href={url}
@@ -32,6 +37,7 @@ export const ProductLinkButton = ({ label, url }: ProductLinkButtonProps) => {
3237
data-link-name="in body link"
3338
data-spacefinder-role="inline"
3439
cssOverrides={[linkButtonStyles]}
40+
data-component={dataComponent}
3541
>
3642
{label}
3743
</LinkButton>

0 commit comments

Comments
 (0)