Skip to content

Commit 94d79f9

Browse files
committed
Use new Whole Picture logo in US when switch isON
1 parent 070c22f commit 94d79f9

File tree

6 files changed

+117
-4
lines changed

6 files changed

+117
-4
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ type Props = {
2222
hasPageSkin?: boolean;
2323
hasPageSkinContentSelfConstrain?: boolean;
2424
pageId?: string;
25+
wholePictureLogoSwitch?: boolean;
2526
};
2627

2728
/**
@@ -56,6 +57,7 @@ export const Masthead = ({
5657
hasPageSkin = false,
5758
hasPageSkinContentSelfConstrain = false,
5859
pageId,
60+
wholePictureLogoSwitch = false,
5961
}: Props) => (
6062
<header data-component="header">
6163
<Section
@@ -112,6 +114,7 @@ export const Masthead = ({
112114
showSlimNav={showSlimNav}
113115
hasPageSkin={hasPageSkin}
114116
pageId={pageId}
117+
wholePictureLogoSwitch={wholePictureLogoSwitch}
115118
/>
116119
</Island>
117120
</header>

dotcom-rendering/src/components/Masthead/Titlepiece/Logo.tsx

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { css } from '@emotion/react';
22
import { from, space, visuallyHidden } from '@guardian/source/foundations';
3-
import { SvgGuardianLogo } from '@guardian/source/react-components';
3+
import { Hide, SvgGuardianLogo } from '@guardian/source/react-components';
44
import { nestedOphanComponents } from '../../../lib/ophan-helpers';
55
import { palette } from '../../../palette';
6+
import TheWholePictureGuardianLogoSmall from '../../../static/icons/the-guardian-whole-picture-logo-small.svg';
7+
import TheWholePictureGuardianLogo from '../../../static/icons/the-guardian-whole-picture-logo.svg';
68

79
const gridMainColumn = css`
810
grid-column: main-column-start / main-column-end;
@@ -20,6 +22,7 @@ const logoStyles = css`
2022
margin-top: ${space[2]}px;
2123
margin-bottom: 6px;
2224
right: ${veggieBurgerDiameter + space[3]}px;
25+
2326
${from.mobileMedium} {
2427
right: 0;
2528
}
@@ -49,6 +52,22 @@ const logoStylesFromLeftCol = css`
4952
}
5053
`;
5154

55+
const theWholePictureStyles = css`
56+
margin-bottom: 2px;
57+
${from.tablet} {
58+
margin-top: 10px;
59+
margin-bottom: 6px;
60+
}
61+
62+
svg {
63+
height: auto;
64+
width: 173px;
65+
${from.tablet} {
66+
width: 246px;
67+
}
68+
}
69+
`;
70+
5271
const slimNavLogoOverrides = css`
5372
position: relative;
5473
margin-top: ${space[2]}px;
@@ -83,15 +102,25 @@ const slimNavLogoOverrides = css`
83102
`;
84103

85104
type Props = {
105+
/**
106+
* We are running a campaign in the US called "The Whole Picture"
107+
* We will use a different logo for the US edition for the duration of this campaign.
108+
*/
109+
showWholePictureLogo: boolean;
86110
hasPageSkin: boolean;
87111
showSlimNav: boolean;
88112
};
89113

90-
export const Logo = ({ hasPageSkin, showSlimNav }: Props) => (
114+
export const Logo = ({
115+
showWholePictureLogo,
116+
hasPageSkin,
117+
showSlimNav,
118+
}: Props) => (
91119
<div
92120
css={[
93121
logoStyles,
94122
!hasPageSkin && logoStylesFromLeftCol,
123+
!showWholePictureLogo && theWholePictureStyles,
95124
showSlimNav && slimNavLogoOverrides,
96125
]}
97126
>
@@ -103,7 +132,21 @@ export const Logo = ({ hasPageSkin, showSlimNav }: Props) => (
103132
>
104133
The Guardian - Back to home
105134
</span>
106-
<SvgGuardianLogo textColor={palette('--masthead-nav-link-text')} />
135+
136+
{!showWholePictureLogo ? (
137+
<>
138+
<Hide from="tablet">
139+
<TheWholePictureGuardianLogoSmall />
140+
</Hide>
141+
<Hide until="tablet">
142+
<TheWholePictureGuardianLogo />
143+
</Hide>
144+
</>
145+
) : (
146+
<SvgGuardianLogo
147+
textColor={palette('--masthead-nav-link-text')}
148+
/>
149+
)}
107150
</a>
108151
</div>
109152
);

dotcom-rendering/src/components/Titlepiece.importable.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ interface Props {
3333
showSlimNav?: boolean;
3434
hasPageSkin?: boolean;
3535
pageId?: string;
36+
wholePictureLogoSwitch?: boolean;
3637
}
3738

3839
const gridContent = css`
@@ -238,6 +239,7 @@ export const Titlepiece = ({
238239
showSlimNav,
239240
hasPageSkin,
240241
pageId = '',
242+
wholePictureLogoSwitch,
241243
}: Props) => {
242244
const { showBanner } = useEditionSwitcherBanner(pageId, editionId);
243245

@@ -419,7 +421,13 @@ export const Titlepiece = ({
419421
</div>
420422

421423
{/* Guardian logo */}
422-
<Logo hasPageSkin={!!hasPageSkin} showSlimNav={!!showSlimNav} />
424+
<Logo
425+
showWholePictureLogo={
426+
!!wholePictureLogoSwitch && editionId === 'US'
427+
}
428+
hasPageSkin={!!hasPageSkin}
429+
showSlimNav={!!showSlimNav}
430+
/>
423431

424432
{/** Expanded menu checkbox */}
425433
<input

dotcom-rendering/src/layouts/FrontLayout.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,9 @@ export const FrontLayout = ({ front, NAV }: Props) => {
227227
hasPageSkin={hasPageSkin}
228228
hasPageSkinContentSelfConstrain={true}
229229
pageId={pageId}
230+
wholePictureLogoSwitch={
231+
front.config.switches.wholePictureLogo
232+
}
230233
/>
231234

232235
{isPaidContent && (
Lines changed: 28 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)