Skip to content

Commit f0ebe3f

Browse files
committed
Rename SponsoredContentLabel to more generic component name and update JSDoc
1 parent 8bf7b82 commit f0ebe3f

File tree

6 files changed

+23
-25
lines changed

6 files changed

+23
-25
lines changed

dotcom-rendering/src/components/SponsoredContentLabel.stories.tsx renamed to dotcom-rendering/src/components/BrandingLabel.stories.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import type { Meta } from '@storybook/react-webpack5';
2-
import { SponsoredContentLabel } from './SponsoredContentLabel';
2+
import { BrandingLabel } from './BrandingLabel';
33

4-
const meta: Meta<typeof SponsoredContentLabel> = {
5-
component: SponsoredContentLabel,
6-
title: 'Components/SponsoredContentLabel',
4+
const meta: Meta<typeof BrandingLabel> = {
5+
component: BrandingLabel,
6+
title: 'Components/BrandingLabel For Labs',
77
parameters: {
88
layout: 'centered',
99
chromatic: {

dotcom-rendering/src/components/SponsoredContentLabel.tsx renamed to dotcom-rendering/src/components/BrandingLabel.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,13 @@ const imageAdvertisingPartnerStyles = css`
100100
`;
101101

102102
/**
103-
* Component used to display "paid for" label alonside the sponsor logo
104-
* for a particular set of branding
103+
* Component used to display branding labels with sponsor logos for
104+
* various types of branded content (paid-content, sponsored, foundation, etc.)
105105
*
106-
* This is used for front container level branding for labs content and
107-
* should replace `CardBranding` eventually
106+
* This is used for front container level branding and supports both Labs
107+
* and non-Labs designs. Should eventually replace `CardBranding` and `Badge`.
108108
*/
109-
export const SponsoredContentLabel = ({
109+
export const BrandingLabel = ({
110110
branding,
111111
alignment = 'start',
112112
orientation = 'horizontal',

dotcom-rendering/src/components/Card/Card.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import type {
3535
import type { MainMedia } from '../../types/mainMedia';
3636
import type { OnwardsSource } from '../../types/onwards';
3737
import { Avatar } from '../Avatar';
38+
import { BrandingLabel } from '../BrandingLabel';
3839
import { CardCommentCount } from '../CardCommentCount.importable';
3940
import { CardHeadline, type ResponsiveFontSize } from '../CardHeadline';
4041
import type { Loading } from '../CardPicture';
@@ -47,7 +48,6 @@ import { Pill } from '../Pill';
4748
import { SlideshowCarousel } from '../SlideshowCarousel.importable';
4849
import { Snap } from '../Snap';
4950
import { SnapCssSandbox } from '../SnapCssSandbox';
50-
import { SponsoredContentLabel } from '../SponsoredContentLabel';
5151
import { StarRating } from '../StarRating/StarRating';
5252
import type { Alignment } from '../SupportingContent';
5353
import { SupportingContent } from '../SupportingContent';
@@ -779,7 +779,7 @@ export const Card = ({
779779
}
780780
`}
781781
>
782-
<SponsoredContentLabel
782+
<BrandingLabel
783783
branding={branding}
784784
containerPalette={containerPalette}
785785
orientation="horizontal"
@@ -800,7 +800,7 @@ export const Card = ({
800800
}
801801
`}
802802
>
803-
<SponsoredContentLabel
803+
<BrandingLabel
804804
branding={branding}
805805
containerPalette={containerPalette}
806806
orientation="vertical"

dotcom-rendering/src/components/FeatureCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import type {
2525
DCRSupportingContent,
2626
} from '../types/front';
2727
import type { MainMedia } from '../types/mainMedia';
28+
import { BrandingLabel } from './BrandingLabel';
2829
import { CardFooter } from './Card/components/CardFooter';
2930
import { CardLink } from './Card/components/CardLink';
3031
import type { MediaSizeType } from './Card/components/MediaWrapper';
@@ -39,7 +40,6 @@ import { FormatBoundary } from './FormatBoundary';
3940
import { Island } from './Island';
4041
import { MediaDuration } from './MediaDuration';
4142
import { Pill } from './Pill';
42-
import { SponsoredContentLabel } from './SponsoredContentLabel';
4343
import { StarRating } from './StarRating/StarRating';
4444
import { SupportingContent } from './SupportingContent';
4545
import { WaveForm } from './WaveForm';
@@ -730,7 +730,7 @@ export const FeatureCard = ({
730730
/>
731731
)}
732732
{isLabs && branding && showLabsRedesign && (
733-
<SponsoredContentLabel
733+
<BrandingLabel
734734
branding={branding}
735735
containerPalette={containerPalette}
736736
orientation="horizontal"

dotcom-rendering/src/components/FrontSection.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import type {
1515
import type { TagPagePagination } from '../types/tagPage';
1616
import { isAustralianTerritory, type Territory } from '../types/territory';
1717
import { AustralianTerritorySwitcher } from './AustralianTerritorySwitcher.importable';
18+
import { BrandingLabel } from './BrandingLabel';
1819
import { ContainerOverrides } from './ContainerOverrides';
1920
import { ContainerTitle } from './ContainerTitle';
2021
import { FrontPagination } from './FrontPagination';
@@ -23,7 +24,6 @@ import { Island } from './Island';
2324
import { LabsSectionHeader } from './LabsSectionHeader';
2425
import { ShowHideButton } from './ShowHideButton';
2526
import { ShowMore } from './ShowMore.importable';
26-
import { SponsoredContentLabel } from './SponsoredContentLabel';
2727
import { Treats } from './Treats';
2828

2929
type Props = {
@@ -829,7 +829,7 @@ export const FrontSection = ({
829829
collectionBranding?.kind === 'paid-content' &&
830830
!collectionBranding.hasMultipleBranding && (
831831
<div css={sponsoredContentLabelWrapper}>
832-
<SponsoredContentLabel
832+
<BrandingLabel
833833
branding={collectionBranding.branding}
834834
containerPalette={containerPalette}
835835
ophanComponentLink={

dotcom-rendering/src/components/FrontSectionTitle.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Hide } from '@guardian/source/react-components';
99
import { assertUnreachable } from '../lib/assert-unreachable';
1010
import { palette } from '../palette';
1111
import type { CollectionBranding } from '../types/branding';
12-
import { SponsoredContentLabel } from './SponsoredContentLabel';
12+
import { BrandingLabel } from './BrandingLabel';
1313

1414
type Props = {
1515
title: React.ReactNode;
@@ -90,14 +90,14 @@ export const FrontSectionTitle = ({ title, collectionBranding }: Props) => {
9090
<>
9191
<Hide until="leftCol">
9292
<p css={[labelStyles]}>{logo.label}</p>
93-
<SponsoredContentLabel
93+
<BrandingLabel
9494
branding={collectionBranding.branding}
9595
/>
9696
</Hide>
9797
<div css={titleStyle}>
9898
<Hide from="leftCol">
9999
<p css={[labelStyles]}>{logo.label}</p>
100-
<SponsoredContentLabel
100+
<BrandingLabel
101101
branding={collectionBranding.branding}
102102
/>
103103
</Hide>
@@ -134,7 +134,7 @@ export const FrontSectionTitle = ({ title, collectionBranding }: Props) => {
134134
`}
135135
>
136136
Paid for by
137-
<SponsoredContentLabel
137+
<BrandingLabel
138138
branding={collectionBranding.branding}
139139
/>
140140
</div>
@@ -145,13 +145,11 @@ export const FrontSectionTitle = ({ title, collectionBranding }: Props) => {
145145
return (
146146
<>
147147
<Hide until="leftCol">
148-
<SponsoredContentLabel
149-
branding={collectionBranding.branding}
150-
/>
148+
<BrandingLabel branding={collectionBranding.branding} />
151149
</Hide>
152150
<div css={titleStyle}>
153151
<Hide from="leftCol">
154-
<SponsoredContentLabel
152+
<BrandingLabel
155153
branding={collectionBranding.branding}
156154
/>
157155
</Hide>
@@ -191,7 +189,7 @@ export const FrontSectionTitle = ({ title, collectionBranding }: Props) => {
191189
>
192190
{logo.label}
193191
</p>
194-
<SponsoredContentLabel
192+
<BrandingLabel
195193
branding={collectionBranding.branding}
196194
isAdvertisingPartner={
197195
isAdvertisingPartnerOrExclusive

0 commit comments

Comments
 (0)