Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Logo styling for advertising partner #11217

Merged
merged 21 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0f34870
Add container width and border
deedeeh Apr 19, 2024
484a6b0
Add the correct width for different breakpoints in articles
deedeeh Apr 22, 2024
ac921a2
Add logo update to section front
deedeeh Apr 24, 2024
2e8f223
Add Front Section new logo with placeholder condition value
deedeeh May 9, 2024
20ac8cf
Fix lint error and update logo for articles with placeholder
deedeeh May 9, 2024
8f7902f
Fix lint error and interactive logo update from desktop
deedeeh May 9, 2024
a34121f
Add margin bottom for Section and Tag fronts
deedeeh May 10, 2024
391c254
Add variant for articles and interactives logo styling
deedeeh May 13, 2024
abaaa58
Add ABtest to Fronts and TagPage plus add inAdvertisingPartnerABTest …
deedeeh May 13, 2024
984618d
Add suggested styling from uk design team
deedeeh May 15, 2024
2728a29
Update leftCol logo size for articles, front and tagPage
deedeeh May 15, 2024
01b950e
Fix the weird shape border in UI
deedeeh May 16, 2024
cd22397
Replace the placeholder with advertising partner or exclusive adverti…
deedeeh May 16, 2024
a48f1ed
Add conditional statement for dotted ruler and address comments
deedeeh May 20, 2024
4f25eb4
Remove value used for testing
deedeeh May 20, 2024
35ce1e4
Merge branch 'main' into dina/update-logo-styling-for-advertising-par…
deedeeh May 20, 2024
e5ca24f
Remove duplicate and add correct syntax
deedeeh May 20, 2024
eaf0c77
Fix lint errors
deedeeh May 20, 2024
7656f98
Replace div with hr
deedeeh May 21, 2024
1157aaa
Keep non advertising partner styles untouched for storybook
deedeeh May 21, 2024
47045a3
Merge branch 'main' into dina/update-logo-styling-for-advertising-par…
deedeeh May 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dotcom-rendering/src/components/ArticleMeta.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe('ArticleMeta', () => {
value={{
renderingTarget: 'Web',
darkModeAvailable: false,
inAdvertisingPartnerABTest: false,
assetOrigin: '/',
}}
>
Expand Down Expand Up @@ -65,6 +66,7 @@ describe('ArticleMeta', () => {
value={{
renderingTarget: 'Web',
darkModeAvailable: false,
inAdvertisingPartnerABTest: false,
assetOrigin: '/',
}}
>
Expand Down
15 changes: 14 additions & 1 deletion dotcom-rendering/src/components/Badge.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '@emotion/react';
import { from } from '@guardian/source-foundations';
import { between, from } from '@guardian/source-foundations';

const frontsSectionBadgeSizingStyles = css`
height: auto;
Expand All @@ -23,6 +23,12 @@ const labsSectionBadgeSizingStyles = css`
}
`;

const imageAdvertisingPartnerStyles = css`
${between.leftCol.and.wide} {
max-width: 130px;
}
`;

const imageStyles = css`
display: block;
width: auto;
Expand All @@ -40,6 +46,8 @@ type Props = {
ophanComponentLink?: string;
ophanComponentName?: string;
isInLabsSection?: boolean;
isAdvertisingPartner?: boolean;
inAdvertisingPartnerABTest?: boolean;
};

export const Badge = ({
Expand All @@ -48,6 +56,8 @@ export const Badge = ({
ophanComponentLink,
ophanComponentName,
isInLabsSection = false,
isAdvertisingPartner = false,
inAdvertisingPartnerABTest = false,
}: Props) => {
return (
<a
Expand All @@ -62,6 +72,9 @@ export const Badge = ({
isInLabsSection
? labsSectionBadgeSizingStyles
: frontsSectionBadgeSizingStyles,
isAdvertisingPartner &&
inAdvertisingPartnerABTest &&
imageAdvertisingPartnerStyles,
]}
src={imageSrc}
alt={isInLabsSection ? 'Labs sponsor logo' : ''}
Expand Down
92 changes: 86 additions & 6 deletions dotcom-rendering/src/components/Branding.importable.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { css } from '@emotion/react';
import { ArticleDesign } from '@guardian/libs';
import { breakpoints, from, textSans12 } from '@guardian/source-foundations';
import {
between,
breakpoints,
from,
textSans12,
} from '@guardian/source-foundations';
import { trackSponsorLogoLinkClick } from '../client/ga/ga';
import { getOphanComponents } from '../lib/labs';
import { palette } from '../palette';
Expand All @@ -11,6 +16,37 @@ const brandingStyle = css`
padding-bottom: 10px;
`;

const brandingAdvertisingPartnerStyle = css`
margin: 4px 0 20px;
padding: 4px;
border: 1px solid ${palette('--branding-border')};
width: fit-content;

${from.desktop} {
padding: 8px;
width: 220px;
}
${from.leftCol} {
padding: 4px;
width: 140px;
}
${from.wide} {
padding: 8px;
width: 220px;
}
`;

const brandingInteractiveStyle = css`
${from.desktop} {
padding: 8px;
width: 220px;
}
`;

const labelAdvertisingPartnerStyle = css`
padding-bottom: 1px;
`;

const labelStyle = css`
${textSans12}
color: ${palette('--branding-label-text')};
Expand All @@ -28,8 +64,16 @@ const liveBlogLabelStyle = css`
}
`;

const brandingLogoAdvertisingPartnerStyle = css`
& img {
display: block;
${between.leftCol.and.wide} {
max-width: 130px;
}
}
`;

const brandingLogoStyle = css`
padding: 10px 0;
display: block;

& img {
Expand All @@ -41,6 +85,7 @@ const aboutLinkStyle = css`
${textSans12}
display: block;
text-decoration: none;
padding-top: 1px;

color: ${palette('--branding-link-text')};
a {
Expand Down Expand Up @@ -152,19 +197,54 @@ type Props = {
export const Branding = ({ branding, format }: Props) => {
const sponsorId = branding.sponsorName.toLowerCase();
const isLiveBlog = format.design === ArticleDesign.LiveBlog;
const isInteractive = format.design === ArticleDesign.Interactive;

const { ophanComponentName, ophanComponentLink } = getOphanComponents({
branding,
locationPrefix: 'article-meta',
});

const { darkModeAvailable } = useConfig();
const { darkModeAvailable, inAdvertisingPartnerABTest } = useConfig();

const isAdvertisingPartnerOrExclusive =
branding.logo.label.toLowerCase() === 'advertising partner' ||
branding.logo.label.toLowerCase() === 'exclusive advertising partner';

const isAdvertisingPartnerAndInteractive =
isAdvertisingPartnerOrExclusive && isInteractive;

return (
<div css={brandingStyle}>
<div css={[labelStyle, isLiveBlog && liveBlogLabelStyle]}>
<div
css={[
brandingStyle,
isAdvertisingPartnerOrExclusive &&
inAdvertisingPartnerABTest &&
brandingAdvertisingPartnerStyle,
isAdvertisingPartnerAndInteractive &&
inAdvertisingPartnerABTest &&
brandingInteractiveStyle,
]}
>
<div
css={[
labelStyle,
isAdvertisingPartnerOrExclusive &&
inAdvertisingPartnerABTest &&
labelAdvertisingPartnerStyle,
isLiveBlog && liveBlogLabelStyle,
]}
>
{branding.logo.label}
</div>
<div css={brandingLogoStyle}>
<div
css={[
brandingLogoStyle,
isAdvertisingPartnerOrExclusive &&
!isInteractive &&
inAdvertisingPartnerABTest &&
brandingLogoAdvertisingPartnerStyle,
]}
>
<a
href={branding.logo.link}
data-sponsor={branding.sponsorName.toLowerCase()}
Expand Down
5 changes: 5 additions & 0 deletions dotcom-rendering/src/components/BylineLink.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ describe('BylineLink', () => {
value={{
renderingTarget: 'Web',
darkModeAvailable: false,
inAdvertisingPartnerABTest: false,
assetOrigin: '/',
}}
>
Expand Down Expand Up @@ -150,6 +151,7 @@ describe('BylineLink', () => {
value={{
renderingTarget: 'Web',
darkModeAvailable: false,
inAdvertisingPartnerABTest: false,
assetOrigin: '/',
}}
>
Expand Down Expand Up @@ -194,6 +196,7 @@ describe('BylineLink', () => {
value={{
renderingTarget: 'Web',
darkModeAvailable: false,
inAdvertisingPartnerABTest: false,
assetOrigin: '/',
}}
>
Expand Down Expand Up @@ -234,6 +237,7 @@ describe('BylineLink', () => {
value={{
renderingTarget: 'Web',
darkModeAvailable: false,
inAdvertisingPartnerABTest: false,
assetOrigin: '/',
}}
>
Expand Down Expand Up @@ -265,6 +269,7 @@ describe('BylineLink', () => {
value={{
renderingTarget: 'Web',
darkModeAvailable: false,
inAdvertisingPartnerABTest: false,
assetOrigin: '/',
}}
>
Expand Down
3 changes: 3 additions & 0 deletions dotcom-rendering/src/components/ConfigContext.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,19 @@ describe('ConfigContext', () => {
{
renderingTarget: 'Web',
darkModeAvailable: false,
inAdvertisingPartnerABTest: false,
assetOrigin: '/',
},
{
renderingTarget: 'Apps',
darkModeAvailable: true,
inAdvertisingPartnerABTest: false,
assetOrigin: '/',
},
{
renderingTarget: 'Apps',
darkModeAvailable: false,
inAdvertisingPartnerABTest: false,
assetOrigin: '/',
},
] as const satisfies ReadonlyArray<Config>)(
Expand Down
2 changes: 2 additions & 0 deletions dotcom-rendering/src/components/Contributor.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe('Contributor', () => {
value={{
renderingTarget: 'Web',
darkModeAvailable: false,
inAdvertisingPartnerABTest: false,
assetOrigin: '/',
}}
>
Expand Down Expand Up @@ -53,6 +54,7 @@ describe('Contributor', () => {
value={{
renderingTarget: 'Web',
darkModeAvailable: false,
inAdvertisingPartnerABTest: false,
assetOrigin: '/',
}}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ describe('App', () => {
value={{
renderingTarget: 'Web',
darkModeAvailable: false,
inAdvertisingPartnerABTest: false,
assetOrigin: '/',
}}
>
Expand Down
6 changes: 6 additions & 0 deletions dotcom-rendering/src/components/Dropdown.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ describe('Dropdown', () => {
value={{
renderingTarget: 'Web',
darkModeAvailable: false,
inAdvertisingPartnerABTest: false,
assetOrigin: '/',
}}
>
Expand All @@ -66,6 +67,7 @@ describe('Dropdown', () => {
value={{
renderingTarget: 'Web',
darkModeAvailable: false,
inAdvertisingPartnerABTest: false,
assetOrigin: '/',
}}
>
Expand All @@ -90,6 +92,7 @@ describe('Dropdown', () => {
value={{
renderingTarget: 'Web',
darkModeAvailable: false,
inAdvertisingPartnerABTest: false,
assetOrigin: '/',
}}
>
Expand All @@ -113,6 +116,7 @@ describe('Dropdown', () => {
value={{
renderingTarget: 'Web',
darkModeAvailable: false,
inAdvertisingPartnerABTest: false,
assetOrigin: '/',
}}
>
Expand All @@ -138,6 +142,7 @@ describe('Dropdown', () => {
value={{
renderingTarget: 'Web',
darkModeAvailable: false,
inAdvertisingPartnerABTest: false,
assetOrigin: '/',
}}
>
Expand All @@ -164,6 +169,7 @@ describe('Dropdown', () => {
value={{
renderingTarget: 'Web',
darkModeAvailable: false,
inAdvertisingPartnerABTest: false,
assetOrigin: '/',
}}
>
Expand Down
3 changes: 3 additions & 0 deletions dotcom-rendering/src/components/FrontSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ type Props = {
discussionApiUrl: string;
collectionBranding?: CollectionBranding;
isTagPage?: boolean;
inAdvertisingPartnerABTest?: boolean;
};

const width = (columns: number, columnWidth: number, columnGap: number) =>
Expand Down Expand Up @@ -462,6 +463,7 @@ export const FrontSection = ({
discussionApiUrl,
collectionBranding,
isTagPage = false,
inAdvertisingPartnerABTest = false,
}: Props) => {
const overrides =
containerPalette && decideContainerOverrides(containerPalette);
Expand Down Expand Up @@ -539,6 +541,7 @@ export const FrontSection = ({
/>
}
collectionBranding={collectionBranding}
inAdvertisingPartnerABTest={inAdvertisingPartnerABTest}
/>

{leftContent}
Expand Down
Loading
Loading