Skip to content

Commit e9183d0

Browse files
authored
[docs-infra] Remove dangerouslySetInnerHTML for ad description (#46936)
1 parent 4a24067 commit e9183d0

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

packages/mui-docs/src/Ad/Ad.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,29 +40,30 @@ const inHouseAds = [
4040
name: 'templates',
4141
link: 'https://mui.com/store/?utm_source=docs&utm_medium=referral&utm_campaign=in-house-templates',
4242
img: '/static/ads-in-house/themes-2.jpg',
43-
description:
44-
'<b>Premium Templates</b>. Start your project with the best templates for admins, dashboards, and more.',
43+
descriptionHeader: 'Premium Templates',
44+
description: 'Start your project with the best templates for admins, dashboards, and more.',
4545
},
4646
{
4747
name: 'themes',
4848
link: 'https://mui.com/store/?utm_source=docs&utm_medium=referral&utm_campaign=in-house-themes',
4949
img: '/static/ads-in-house/themes.png',
50-
description:
51-
'<b>Premium Themes</b>. Kickstart your application development with a ready-made theme.',
50+
descriptionHeader: 'Premium Themes',
51+
description: 'Kickstart your application development with a ready-made theme.',
5252
},
5353
{
5454
name: 'tidelift',
5555
link: 'https://tidelift.com/?utm_source=npm-material-ui&utm_medium=referral&utm_campaign=enterprise&utm_content=ad',
5656
img: '/static/ads-in-house/tidelift.png',
57-
description:
58-
'<b>MUI for enterprise</b>. Save time and reduce risk. Managed open source — backed by maintainers.',
57+
descriptionHeader: 'MUI for enterprise',
58+
description: 'Save time and reduce risk. Managed open source — backed by maintainers.',
5959
},
6060
{
6161
name: 'figma',
6262
link: 'https://mui.com/store/items/figma-react/?utm_source=docs&utm_medium=referral&utm_campaign=in-house-figma',
6363
img: '/static/ads-in-house/figma.png',
64+
descriptionHeader: 'For Figma',
6465
description:
65-
'<b>For Figma</b>. A large UI kit with over 600 handcrafted Material UI, MUI X, Joy UI components 🎨.',
66+
'A large UI kit with over 600 handcrafted Material UI, MUI X, Joy UI components 🎨.',
6667
},
6768
];
6869

packages/mui-docs/src/Ad/AdCarbon.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ export function AdCarbonInline() {
136136
link: ad.statlink,
137137
img: ad.image,
138138
name: ad.company,
139-
description: `<strong>${ad.company}</strong> - ${ad.description}`,
139+
descriptionHeader: ad.company,
140+
description: ad.description,
140141
poweredby: 'Carbon',
141142
label: 'carbon-demo-inline',
142143
}}

packages/mui-docs/src/Ad/AdDisplay.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export interface AdParameters {
3333
name: string;
3434
link: string;
3535
img?: string;
36+
descriptionHeader: string;
3637
description: string;
3738
poweredby: string;
3839
label: string;
@@ -65,7 +66,6 @@ export default function AdDisplay(props: AdDisplayProps) {
6566

6667
const Root = shape === 'image' ? ImageShape : InlineShape;
6768

68-
/* eslint-disable react/no-danger */
6969
return (
7070
<Root className={className}>
7171
<a
@@ -83,15 +83,13 @@ export default function AdDisplay(props: AdDisplayProps) {
8383
<span className="AdDisplay-imageWrapper">
8484
<img height="100" width="130" src={ad.img} alt={ad.name} />
8585
</span>
86-
<span
87-
className="AdDisplay-description"
88-
dangerouslySetInnerHTML={{ __html: ad.description }}
89-
/>
86+
<span className="AdDisplay-description">
87+
<strong>{ad.descriptionHeader}</strong> - {ad.description}
88+
</span>
9089
</a>
9190
<span className="AdDisplay-poweredby">
9291
{t('adPublisher').replace('{{publisher}}', ad.poweredby)}
9392
</span>
9493
</Root>
9594
);
96-
/* eslint-enable react/no-danger */
9795
}

0 commit comments

Comments
 (0)