diff --git a/FeatureFlags.js b/FeatureFlags.js index 97bd8a7fd..af178b6f3 100644 --- a/FeatureFlags.js +++ b/FeatureFlags.js @@ -47,6 +47,7 @@ const MAGAZINE = [...GLOBAL_PROD, ...GLOBAL_DEV] /* Allows same slug for different languages */ const SAME_SLUG = [...GLOBAL_DEV, 'japan', 'southkorea'] const LINE_BREAK_TYPO = ['southkorea'] +const CAMPAIGN = [...GLOBAL_PROD, ...GLOBAL_DEV] /** * @param {string} dataset @@ -72,4 +73,5 @@ export default (dataset) => ({ IS_GLOBAL_PROD: GLOBAL_PROD.includes(dataset), IS_DEV: GLOBAL_DEV.includes(dataset), IS_SATELLITE: SATELLITES.includes(dataset), + HAS_CAMPAIGN_BLOCKS: CAMPAIGN.includes(dataset), }) diff --git a/sanityv3/schemas/documents/page.ts b/sanityv3/schemas/documents/page.ts index 9387bc508..9e59fcf48 100644 --- a/sanityv3/schemas/documents/page.ts +++ b/sanityv3/schemas/documents/page.ts @@ -74,8 +74,8 @@ export default { { type: 'videoPlayer' }, { type: 'videoPlayerCarousel' }, { type: 'table' }, - { type: 'grid' }, - { type: 'campaignBanner' }, + Flags.HAS_CAMPAIGN_BLOCKS && { type: 'grid' }, + Flags.HAS_CAMPAIGN_BLOCKS && { type: 'campaignBanner' }, Flags.HAS_FORMS && { type: 'form' }, Flags.HAS_NEWS && { type: 'newsList' }, { type: 'stockValuesApi' }, diff --git a/sanityv3/schemas/objects/teaser.tsx b/sanityv3/schemas/objects/teaser.tsx index e738943ec..bcdaef655 100644 --- a/sanityv3/schemas/objects/teaser.tsx +++ b/sanityv3/schemas/objects/teaser.tsx @@ -142,15 +142,21 @@ export default { }, { name: 'action', - title: 'Link/action', - description: 'Select the link or downloadable file for the teaser', + title: 'Links/actions', + description: 'Select links or downloadable files for the teaser', type: 'array', of: [ { type: 'linkSelector', title: 'Link' }, { type: 'downloadableImage', title: 'Downloadable image' }, { type: 'downloadableFile', title: 'Downloadable file' }, ], - validation: (Rule: Rule) => Rule.max(1).error('Only one action is permitted'), + validation: (Rule: Rule) => Rule.max(2).error('Only two action is permitted'), + }, + { + title: 'Use resource link style', + description: 'Default is read more link style', + name: 'useResourceLinks', + type: 'boolean', }, { name: 'image', diff --git a/web/lib/queries/common/pageContentFields.ts b/web/lib/queries/common/pageContentFields.ts index 3b24e0c40..f7a5d1afe 100644 --- a/web/lib/queries/common/pageContentFields.ts +++ b/web/lib/queries/common/pageContentFields.ts @@ -39,11 +39,12 @@ _type == "keyNumbers" =>{ ..., "extension": asset-> extension }, - "action": action[0]{ + "actions": action[]{ ${linkSelectorFields}, ${downloadableFileFields}, ${downloadableImageFields}, }, + useResourceLinks }, _type == "textTeaser" => { @@ -566,7 +567,6 @@ _type == "keyNumbers" =>{ "backgroundUtility":coalesce(backgroundColor.key, ""), } }, - }, ` diff --git a/web/pageComponents/pageTemplates/TopicPage.tsx b/web/pageComponents/pageTemplates/TopicPage.tsx index 063417ab7..1a536100a 100644 --- a/web/pageComponents/pageTemplates/TopicPage.tsx +++ b/web/pageComponents/pageTemplates/TopicPage.tsx @@ -1,3 +1,4 @@ +import { toPlainText } from '@portabletext/react' import useSharedTitleStyles from '../../lib/hooks/useSharedTitleStyles' import { HeroTypes, TopicPageSchema } from '../../types/types' import Seo from '../shared/Seo' @@ -26,6 +27,7 @@ const TopicPage = ({ data }: TopicPageProps) => { {!data?.isCampaign && ( )} + {data.isCampaign &&

{toPlainText(data.title)}

} {breadcrumbs && breadcrumbs?.enableBreadcrumbs && ( { } const Teaser = ({ data, anchor }: TeaserProps) => { - const { title, overline, text, image, action, designOptions, isBigText } = data + const { title, overline, text, image, actions, designOptions, isBigText, useResourceLinks } = data const { imageSize, imagePosition, ...restOptions } = designOptions - if ([title, overline, text, image?.asset, action].every((i) => !i)) { + if ([title, overline, text, image?.asset, actions].every((i) => !i)) { return null } - const url = action && getUrlFromAction(action) - const isSvg = image?.extension === 'svg' return ( @@ -80,14 +78,30 @@ const Teaser = ({ data, anchor }: TeaserProps) => { {text && } )} - {action && url && ( - - {`${action.label} ${action.extension ? `(${action.extension.toUpperCase()})` : ''}`} - + {actions && ( +
+ {actions?.map((action) => { + const url = action && getUrlFromAction(action) + + return useResourceLinks ? ( + + {`${action.label} ${action.extension ? `(${action.extension.toUpperCase()})` : ''}`} + + ) : ( + + {`${action.label} ${action.extension ? `(${action.extension.toUpperCase()})` : ''}`} + + ) + })} +
)} diff --git a/web/sections/Grid/Grid.tsx b/web/sections/Grid/Grid.tsx index 42417f7f1..ba9f8ed2e 100644 --- a/web/sections/Grid/Grid.tsx +++ b/web/sections/Grid/Grid.tsx @@ -36,9 +36,9 @@ const Grid = forwardRef(function Grid({ data, anchor, cl {gridRows.map((row) => { return ( <> - {row?.type === 'span3' && } - {row?.type === 'span2and1' && } - {row?.type === 'threeColumns' && } + {row?.type === 'span3' && } + {row?.type === 'span2and1' && } + {row?.type === 'threeColumns' && } ) })} diff --git a/web/sections/Grid/Span3.tsx b/web/sections/Grid/Span3.tsx index cd6263242..9f205a39a 100644 --- a/web/sections/Grid/Span3.tsx +++ b/web/sections/Grid/Span3.tsx @@ -8,7 +8,6 @@ export type Span3Props = { } & HTMLAttributes const Span3 = forwardRef(function Span3({ data, className = '', ...rest }, ref) { - console.log('data?.content', data?.content) return (