Skip to content

Commit 94eb9d4

Browse files
committed
Add a check if branding exists to fix typescript errors
1 parent 9ecaa20 commit 94eb9d4

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

dotcom-rendering/src/components/HostedContentHeader.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import type { Branding } from '../types/branding';
1515
import { BrandingLabel } from './BrandingLabel';
1616

1717
export type Props = {
18-
accentColor: string;
1918
branding: Branding;
19+
accentColor?: string;
2020
};
2121

2222
const HOSTED_CONTENT_HEIGHT_MOBILE = 48;
@@ -256,14 +256,14 @@ const HostedContentLogo = () => (
256256
</div>
257257
);
258258

259-
export const HostedContentHeader = ({ accentColor, branding }: Props) => {
259+
export const HostedContentHeader = ({ branding, accentColor }: Props) => {
260260
return (
261261
<HeaderWrapper>
262262
<Left>
263263
<HeaderSection isFirst={true}>
264264
<TitleAndBadge
265-
accentColor={accentColor}
266265
branding={branding}
266+
accentColor={accentColor}
267267
/>
268268
</HeaderSection>
269269
<HeaderSection>

dotcom-rendering/src/layouts/HostedArticleLayout.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ export const HostedArticleLayout = (props: WebProps | AppProps) => {
6262
const mainMedia = frontendData.mainMediaElements[0];
6363
const mainMediaCaptionText = decideMainMediaCaption(mainMedia);
6464

65-
const branding =
66-
frontendData.commercialProperties[frontendData.editionId].branding;
65+
const { branding } =
66+
frontendData.commercialProperties[frontendData.editionId];
6767

6868
return (
6969
<>
70-
{props.renderingTarget === 'Web' ? (
70+
{props.renderingTarget === 'Web' && branding ? (
7171
<Stuck>
7272
<Section
7373
fullWidth={true}
@@ -79,8 +79,8 @@ export const HostedArticleLayout = (props: WebProps | AppProps) => {
7979
element="aside"
8080
>
8181
<HostedContentHeader
82-
accentColor={branding.hostedCampaignColour}
8382
branding={branding}
83+
accentColor={branding.hostedCampaignColour}
8484
/>
8585
</Section>
8686
</Stuck>

dotcom-rendering/src/layouts/HostedGalleryLayout.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ export const HostedGalleryLayout = (props: WebProps | AppProps) => {
4545
format,
4646
} = props;
4747

48-
const branding =
49-
frontendData.commercialProperties[frontendData.editionId].branding;
48+
const { branding } =
49+
frontendData.commercialProperties[frontendData.editionId];
5050

5151
return (
5252
<>
53-
{props.renderingTarget === 'Web' ? (
53+
{props.renderingTarget === 'Web' && branding ? (
5454
<Stuck>
5555
<Section
5656
fullWidth={true}
@@ -62,8 +62,8 @@ export const HostedGalleryLayout = (props: WebProps | AppProps) => {
6262
element="aside"
6363
>
6464
<HostedContentHeader
65-
accentColor={branding.hostedCampaignColour}
6665
branding={branding}
66+
accentColor={branding.hostedCampaignColour}
6767
/>
6868
</Section>
6969
</Stuck>

0 commit comments

Comments
 (0)