@financial-times/cp-content-pipeline-ui 9.9.0 → 9.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/lib/components/Topper/{Columnist.d.ts → Columnists.d.ts} +3 -3
- package/lib/components/Topper/Columnists.js +22 -0
- package/lib/components/Topper/Columnists.js.map +1 -0
- package/lib/components/Topper/Tags.d.ts +1 -1
- package/lib/components/Topper/Tags.js +2 -2
- package/lib/components/Topper/Tags.js.map +1 -1
- package/lib/components/Topper/index.js +17 -8
- package/lib/components/Topper/index.js.map +1 -1
- package/package.json +4 -4
- package/src/components/Topper/Columnists.tsx +50 -0
- package/src/components/Topper/Tags.tsx +3 -3
- package/src/components/Topper/index.tsx +21 -10
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/components/Topper/Columnist.js +0 -18
- package/lib/components/Topper/Columnist.js.map +0 -1
- package/src/components/Topper/Columnist.tsx +0 -40
package/CHANGELOG.md
CHANGED
|
@@ -574,6 +574,22 @@
|
|
|
574
574
|
* @financial-times/cp-content-pipeline-client bumped from ^3.7.2 to ^3.7.3
|
|
575
575
|
* @financial-times/cp-content-pipeline-schema bumped from ^2.10.1 to ^2.10.2
|
|
576
576
|
|
|
577
|
+
## [9.10.0](https://github.com/Financial-Times/cp-content-pipeline/compare/cp-content-pipeline-ui-v9.9.0...cp-content-pipeline-ui-v9.10.0) (2025-11-06)
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
### Features
|
|
581
|
+
|
|
582
|
+
* ci-3143 support multiple authors opinion topper ([f71ee09](https://github.com/Financial-Times/cp-content-pipeline/commit/f71ee09098acbcbd9c6f141757970b741db69586))
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
### Dependencies
|
|
586
|
+
|
|
587
|
+
* The following workspace dependencies were updated
|
|
588
|
+
* devDependencies
|
|
589
|
+
* @financial-times/cp-content-pipeline-client bumped from ^4.18.0 to ^4.19.0
|
|
590
|
+
* @financial-times/cp-content-pipeline-schema bumped from ^3.17.0 to ^3.18.0
|
|
591
|
+
* @financial-times/cp-content-pipeline-styles bumped from ^4.4.0 to ^4.5.0
|
|
592
|
+
|
|
577
593
|
## [9.9.0](https://github.com/Financial-Times/cp-content-pipeline/compare/cp-content-pipeline-ui-v9.8.0...cp-content-pipeline-ui-v9.9.0) (2025-11-04)
|
|
578
594
|
|
|
579
595
|
|
|
@@ -2,9 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import type { ConceptFragment, TopperFragment } from '@financial-times/cp-content-pipeline-client';
|
|
3
3
|
import { FollowButtonSlot } from './FollowButtonSlot';
|
|
4
4
|
type ColumnistProps = {
|
|
5
|
-
|
|
5
|
+
authorConcepts: ConceptFragment[];
|
|
6
6
|
followButtonVariant?: TopperFragment['followButtonVariant'];
|
|
7
7
|
followButtonSlot?: FollowButtonSlot;
|
|
8
8
|
};
|
|
9
|
-
declare const
|
|
10
|
-
export default
|
|
9
|
+
declare const Columnists: React.FC<ColumnistProps>;
|
|
10
|
+
export default Columnists;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const Columnists = ({ authorConcepts, followButtonVariant, followButtonSlot, }) => {
|
|
8
|
+
return (react_1.default.createElement("div", { className: "o-topper__columnist" },
|
|
9
|
+
react_1.default.createElement("ul", { className: "o-topper__columnist-list" }, authorConcepts.map((author) => {
|
|
10
|
+
return (react_1.default.createElement("li", null,
|
|
11
|
+
react_1.default.createElement("a", { className: "o-topper__columnist-name n-content-tag--with-follow", href: author.relativeUrl ?? undefined, "data-trackable": "columnist" }, author.prefLabel),
|
|
12
|
+
authorConcepts.length === 1 &&
|
|
13
|
+
followButtonSlot &&
|
|
14
|
+
followButtonSlot({
|
|
15
|
+
conceptId: author.id,
|
|
16
|
+
conceptName: author.prefLabel,
|
|
17
|
+
variant: followButtonVariant ?? 'standard',
|
|
18
|
+
})));
|
|
19
|
+
}))));
|
|
20
|
+
};
|
|
21
|
+
exports.default = Columnists;
|
|
22
|
+
//# sourceMappingURL=Columnists.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Columnists.js","sourceRoot":"","sources":["../../../src/components/Topper/Columnists.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AAezB,MAAM,UAAU,GAA6B,CAAC,EAC5C,cAAc,EACd,mBAAmB,EACnB,gBAAgB,GACjB,EAAE,EAAE;IACH,OAAO,CACL,uCAAK,SAAS,EAAC,qBAAqB;QAClC,sCAAI,SAAS,EAAC,0BAA0B,IACrC,cAAc,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YAC7B,OAAO,CACL;gBACE,qCACE,SAAS,EAAC,qDAAqD,EAC/D,IAAI,EAAE,MAAM,CAAC,WAAW,IAAI,SAAS,oBACtB,WAAW,IAEzB,MAAM,CAAC,SAAS,CACf;gBAEH,cAAc,CAAC,MAAM,KAAK,CAAC;oBAC1B,gBAAgB;oBAChB,gBAAgB,CAAC;wBACf,SAAS,EAAE,MAAM,CAAC,EAAE;wBACpB,WAAW,EAAE,MAAM,CAAC,SAAS;wBAC7B,OAAO,EAAE,mBAAmB,IAAI,UAAU;qBAC3C,CAAC,CACD,CACN,CAAA;QACH,CAAC,CAAC,CACC,CACD,CACP,CAAA;AACH,CAAC,CAAA;AAED,kBAAe,UAAU,CAAA"}
|
|
@@ -7,7 +7,7 @@ type TagsProps = {
|
|
|
7
7
|
displayConcept?: ConceptFragment;
|
|
8
8
|
genreConcept?: ConceptFragment;
|
|
9
9
|
brandConcept?: ConceptFragment;
|
|
10
|
-
|
|
10
|
+
hasColumnists?: boolean;
|
|
11
11
|
followButtonVariant?: TopperFragment['followButtonVariant'];
|
|
12
12
|
FollowButtonSlot?: FollowButtonSlot;
|
|
13
13
|
headshot?: string;
|
|
@@ -4,11 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const Tags = ({ __typename, isPackage, displayConcept, genreConcept, brandConcept,
|
|
7
|
+
const Tags = ({ __typename, isPackage, displayConcept, genreConcept, brandConcept, hasColumnists, followButtonVariant, headshot, FollowButtonSlot, }) => {
|
|
8
8
|
const isOpinion = __typename === 'OpinionTopper';
|
|
9
9
|
const concept = getConcept(displayConcept, genreConcept);
|
|
10
10
|
const baseFollowButtonCondition = FollowButtonSlot && concept?.id;
|
|
11
|
-
const additionalFollowButtonCondition = (isOpinion && !headshot && !
|
|
11
|
+
const additionalFollowButtonCondition = (isOpinion && !headshot && !hasColumnists) || !isOpinion;
|
|
12
12
|
const followButtonCondition = baseFollowButtonCondition && additionalFollowButtonCondition;
|
|
13
13
|
return (react_1.default.createElement("div", { className: "o-topper__tags" }, isPackage && brandConcept?.id ? (react_1.default.createElement(ConceptLabel, { ...brandConcept })) : (!isPackage && (react_1.default.createElement("div", { className: "topper__primary-theme" },
|
|
14
14
|
isOpinion && (react_1.default.createElement("span", { className: "o-topper__opinion-genre", "aria-label": "opinion article" }, `Opinion `)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tags.js","sourceRoot":"","sources":["../../../src/components/Topper/Tags.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AAoBzB,MAAM,IAAI,GAAwB,CAAC,EACjC,UAAU,EACV,SAAS,EACT,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,
|
|
1
|
+
{"version":3,"file":"Tags.js","sourceRoot":"","sources":["../../../src/components/Topper/Tags.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AAoBzB,MAAM,IAAI,GAAwB,CAAC,EAC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,IAAI,YAAY,EAAE,EAAE,EAAE,CAAC;QAC5B,OAAO,YAAY,CAAA;IACrB,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAED,MAAM,YAAY,GAA8B,CAAC,OAAO,EAAE,EAAE;IAC1D,OAAO,CACL,qCACE,IAAI,EAAE,OAAO,CAAC,WAAW,IAAI,SAAS,EACtC,SAAS,EAAC,iBAAiB,oBACZ,eAAe,gBAClB,eAAe,OAAO,CAAC,SAAS,SAAS;QAEpD,OAAO,CAAC,SAAS;kBAChB,CACL,CAAA;AACH,CAAC,CAAA;AAED,MAAM,YAAY,GAA8B,CAAC,OAAO,EAAE,EAAE;IAC1D,OAAO,CACL,qCACE,IAAI,EAAE,OAAO,CAAC,WAAW,EACzB,SAAS,EAAC,6DAA6D,oBACxD,eAAe,gBAClB,sBAAsB,OAAO,CAAC,SAAS,EAAE,qBACpC,OAAO,CAAC,EAAE,IAE1B,OAAO,CAAC,SAAS,CAChB,CACL,CAAA;AACH,CAAC,CAAA;AAED,kBAAe,IAAI,CAAA"}
|
|
@@ -33,7 +33,7 @@ const Headline_1 = __importDefault(require("./Headline"));
|
|
|
33
33
|
const Intro_1 = __importDefault(require("./Intro"));
|
|
34
34
|
const Picture_1 = __importDefault(require("./Picture"));
|
|
35
35
|
const Headshot_1 = __importDefault(require("../Headshot"));
|
|
36
|
-
const
|
|
36
|
+
const Columnists_1 = __importDefault(require("./Columnists"));
|
|
37
37
|
const LiveBlogIndicator_1 = __importDefault(require("./LiveBlogIndicator"));
|
|
38
38
|
const Flourish_1 = __importDefault(require("../content-tree/Flourish"));
|
|
39
39
|
const classnames_1 = __importDefault(require("classnames"));
|
|
@@ -62,7 +62,16 @@ const Topper = ({ content, slot, followButtonSlot, showPremiumLabel = false, rea
|
|
|
62
62
|
const hasLayoutWidth = 'layoutWidth' in topper && topper.layoutWidth;
|
|
63
63
|
const hasDesign = 'design' in topper && topper.design;
|
|
64
64
|
const hasHeadshot = 'headshot' in topper && topper.headshot;
|
|
65
|
-
const
|
|
65
|
+
const hasColumnists = 'columnists' in topper &&
|
|
66
|
+
!!topper.columnists &&
|
|
67
|
+
topper.columnists.length > 0;
|
|
68
|
+
const legacyHasColumnist = 'columnist' in topper && !!topper.columnist; // @deprecated Replaced with usage of `columinists`
|
|
69
|
+
const hasOneColumnist = (hasColumnists && topper.columnists.length === 1) || legacyHasColumnist;
|
|
70
|
+
const oneColumnist = hasOneColumnist
|
|
71
|
+
? hasColumnists
|
|
72
|
+
? topper.columnists[0]
|
|
73
|
+
: topper.columnist
|
|
74
|
+
: null;
|
|
66
75
|
const sponsorName = 'clientName' in content && content.clientName;
|
|
67
76
|
const disclaimerType = isArticle ? content.disclaimerType : undefined;
|
|
68
77
|
const modifiers = [];
|
|
@@ -74,8 +83,8 @@ const Topper = ({ content, slot, followButtonSlot, showPremiumLabel = false, rea
|
|
|
74
83
|
slot && modifiers.push('right-rail');
|
|
75
84
|
hasLayoutWidth &&
|
|
76
85
|
modifiers.push(topper.layoutWidth === 'full-grid' ? 'full-grid' : 'in-line');
|
|
77
|
-
const headshotAltText = isOpinion &&
|
|
78
|
-
? `Headshot for ${
|
|
86
|
+
const headshotAltText = isOpinion && oneColumnist
|
|
87
|
+
? `Headshot for ${oneColumnist.prefLabel}`
|
|
79
88
|
: isPodcast
|
|
80
89
|
? 'Cover photo for podcast'
|
|
81
90
|
: '';
|
|
@@ -108,7 +117,7 @@ const Topper = ({ content, slot, followButtonSlot, showPremiumLabel = false, rea
|
|
|
108
117
|
'o-topper__content--background-box': topper.backgroundBox,
|
|
109
118
|
}), id: "o-topper" },
|
|
110
119
|
isLiveBlog ? (react_1.default.createElement("div", { className: "o-topper__tags" },
|
|
111
|
-
react_1.default.createElement(LiveBlogIndicator_1.default, { realtime: content.realtime ?? undefined, lastUpdatedDateTime: getMostRecentPostPublishedDate() }))) : (react_1.default.createElement(Tags_1.default, { __typename: topper.__typename, isPackage: isPackage, displayConcept: topper.displayConcept ?? undefined, brandConcept: ('brandConcept' in topper && topper.brandConcept) || undefined, genreConcept: ('genreConcept' in topper && topper.genreConcept) || undefined, headshot: hasHeadshot || undefined,
|
|
120
|
+
react_1.default.createElement(LiveBlogIndicator_1.default, { realtime: content.realtime ?? undefined, lastUpdatedDateTime: getMostRecentPostPublishedDate() }))) : (react_1.default.createElement(Tags_1.default, { __typename: topper.__typename, isPackage: isPackage, displayConcept: topper.displayConcept ?? undefined, brandConcept: ('brandConcept' in topper && topper.brandConcept) || undefined, genreConcept: ('genreConcept' in topper && topper.genreConcept) || undefined, headshot: hasHeadshot || undefined, hasColumnists: hasColumnists, followButtonVariant: topper.followButtonVariant, FollowButtonSlot: followButtonSlot })),
|
|
112
121
|
react_1.default.createElement(Headline_1.default, { headline: topper.headline, showPremiumLabel: showPremiumLabel && content.accessLevel === 'premium', isLargeHeadline: ('isLargeHeadline' in topper && topper.isLargeHeadline) ??
|
|
113
122
|
undefined }),
|
|
114
123
|
isLiveBlog && isFlourish ? (react_1.default.createElement(Flourish_1.default, { content: {
|
|
@@ -119,9 +128,9 @@ const Topper = ({ content, slot, followButtonSlot, showPremiumLabel = false, rea
|
|
|
119
128
|
fallbackImage: topper.leadFlourish.fallbackImage ?? undefined,
|
|
120
129
|
}, iFrame: true, inArticleBody: false })) : (''),
|
|
121
130
|
topper.intro && (react_1.default.createElement(Intro_1.default, { structured: topper.intro.structured, source: topper.intro.source })),
|
|
122
|
-
hasHeadshot && !isAudio && isOpinion &&
|
|
123
|
-
react_1.default.createElement(Headshot_1.default, { headshot: topper.headshot, prefLabel:
|
|
124
|
-
isOpinion &&
|
|
131
|
+
hasHeadshot && !isAudio && isOpinion && oneColumnist && (react_1.default.createElement("div", { className: "o-topper__headshot" },
|
|
132
|
+
react_1.default.createElement(Headshot_1.default, { headshot: topper.headshot, prefLabel: oneColumnist.prefLabel, className: 'o-topper__headshot-image', altText: headshotAltText }))),
|
|
133
|
+
isOpinion && hasColumnists && (react_1.default.createElement(Columnists_1.default, { authorConcepts: [...topper.columnists], followButtonVariant: topper.followButtonVariant, followButtonSlot: followButtonSlot }))),
|
|
125
134
|
readNextSlot && (react_1.default.createElement("div", { className: "o-topper__read-next" }, readNextSlot())),
|
|
126
135
|
react_1.default.createElement("div", { className: "o-topper__background" }),
|
|
127
136
|
'images' in topper && react_1.default.createElement(Picture_1.default, { topper: topper })))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Topper/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAqD;AACrD,wDAA+B;AAC/B,kDAAyB;AACzB,0DAAiC;AACjC,oDAA2B;AAC3B,wDAA+B;AAC/B,2DAAkC;AAClC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Topper/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAqD;AACrD,wDAA+B;AAC/B,kDAAyB;AACzB,0DAAiC;AACjC,oDAA2B;AAC3B,wDAA+B;AAC/B,2DAAkC;AAClC,8DAAqC;AACrC,4EAAmD;AAEnD,wEAA+C;AAC/C,4DAAmC;AAKnC,mFAA0D;AAU1D,MAAM,mBAAmB,GAGrB;IACF,oBAAoB,EAAE,CAAC,WAAW,EAAE,EAAE,CACpC,gCAAgC,WAAW,6EAA6E;IAC1H,yBAAyB,EAAE,CAAC,WAAW,EAAE,EAAE,CACzC,6CAA6C,WAAW,EAAE;IAC5D,kBAAkB,EAAE,CAAC,WAAW,EAAE,EAAE,CAClC,yGAAyG,WAAW,EAAE;IACxH,OAAO,EAAE,CAAC,WAAW,EAAE,EAAE,CACvB,6CAA6C,WAAW,iDAAiD;CAC5G,CAAA;AAED,MAAM,MAAM,GAA0B,CAAC,EACrC,OAAO,EACP,IAAI,EACJ,gBAAgB,EAChB,gBAAgB,GAAG,KAAK,EACxB,YAAY,GACb,EAAE,EAAE;IACH,MAAM,EAAE,MAAM,EAAE,GAAG,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BAClD,aAAa,EAAE,MAAM,CAAC,YAAY,CAAC,aAAa,IAAI,SAAS;yBAC9D,EACD,MAAM,EAAE,IAAI,EACZ,aAAa,EAAE,KAAK,GACpB,CACH,CAAC,CAAC,CAAC,CACF,EAAE,CACH;oBACA,MAAM,CAAC,KAAK,IAAI,CACf,8BAAC,eAAK,IACJ,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,UAAU,EACnC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,GAC3B,CACH;oBACA,WAAW,IAAI,CAAC,OAAO,IAAI,SAAS,IAAI,YAAY,IAAI,CACvD,uCAAK,SAAS,EAAC,oBAAoB;wBACjC,8BAAC,kBAAQ,IACP,QAAQ,EAAE,MAAM,CAAC,QAAQ,EACzB,SAAS,EAAE,YAAY,CAAC,SAAS,EACjC,SAAS,EAAE,0BAA0B,EACrC,OAAO,EAAE,eAAe,GACxB,CACE,CACP;oBACA,SAAS,IAAI,aAAa,IAAI,CAC7B,8BAAC,oBAAU,IACT,cAAc,EAAE,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,EACtC,mBAAmB,EAAE,MAAM,CAAC,mBAAmB,EAC/C,gBAAgB,EAAE,gBAAgB,GAClC,CACH,CACG;gBACL,YAAY,IAAI,CACf,uCAAK,SAAS,EAAC,qBAAqB,IAAE,YAAY,EAAE,CAAO,CAC5D;gBACD,uCAAK,SAAS,EAAC,sBAAsB,GAAG;gBACvC,QAAQ,IAAI,MAAM,IAAI,8BAAC,iBAAO,IAAC,MAAM,EAAE,MAAM,GAAI,CAC1C,CACN,CACG,CACZ,CAAA;AACH,CAAC,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@financial-times/cp-content-pipeline-ui",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.10.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"@babel/preset-env": "^7.22.5",
|
|
17
17
|
"@babel/preset-react": "^7.22.5",
|
|
18
18
|
"@financial-times/content-tree": "github:financial-times/content-tree#3f77ec4",
|
|
19
|
-
"@financial-times/cp-content-pipeline-client": "^4.
|
|
20
|
-
"@financial-times/cp-content-pipeline-schema": "^3.
|
|
21
|
-
"@financial-times/cp-content-pipeline-styles": "^4.
|
|
19
|
+
"@financial-times/cp-content-pipeline-client": "^4.19.0",
|
|
20
|
+
"@financial-times/cp-content-pipeline-schema": "^3.18.0",
|
|
21
|
+
"@financial-times/cp-content-pipeline-styles": "^4.5.0",
|
|
22
22
|
"@financial-times/n-scrollytelling-image": "^1.1.0",
|
|
23
23
|
"@financial-times/o-grid": "^6.1.8",
|
|
24
24
|
"@financial-times/o-share": "^11.0.0",
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
ConceptFragment,
|
|
5
|
+
TopperFragment,
|
|
6
|
+
} from '@financial-times/cp-content-pipeline-client'
|
|
7
|
+
|
|
8
|
+
import { FollowButtonSlot } from './FollowButtonSlot'
|
|
9
|
+
|
|
10
|
+
type ColumnistProps = {
|
|
11
|
+
authorConcepts: ConceptFragment[]
|
|
12
|
+
followButtonVariant?: TopperFragment['followButtonVariant']
|
|
13
|
+
followButtonSlot?: FollowButtonSlot
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const Columnists: React.FC<ColumnistProps> = ({
|
|
17
|
+
authorConcepts,
|
|
18
|
+
followButtonVariant,
|
|
19
|
+
followButtonSlot,
|
|
20
|
+
}) => {
|
|
21
|
+
return (
|
|
22
|
+
<div className="o-topper__columnist">
|
|
23
|
+
<ul className="o-topper__columnist-list">
|
|
24
|
+
{authorConcepts.map((author) => {
|
|
25
|
+
return (
|
|
26
|
+
<li>
|
|
27
|
+
<a
|
|
28
|
+
className="o-topper__columnist-name n-content-tag--with-follow"
|
|
29
|
+
href={author.relativeUrl ?? undefined}
|
|
30
|
+
data-trackable="columnist"
|
|
31
|
+
>
|
|
32
|
+
{author.prefLabel}
|
|
33
|
+
</a>
|
|
34
|
+
{/* Only show follow button if there's a single author */}
|
|
35
|
+
{authorConcepts.length === 1 &&
|
|
36
|
+
followButtonSlot &&
|
|
37
|
+
followButtonSlot({
|
|
38
|
+
conceptId: author.id,
|
|
39
|
+
conceptName: author.prefLabel,
|
|
40
|
+
variant: followButtonVariant ?? 'standard',
|
|
41
|
+
})}
|
|
42
|
+
</li>
|
|
43
|
+
)
|
|
44
|
+
})}
|
|
45
|
+
</ul>
|
|
46
|
+
</div>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default Columnists
|
|
@@ -12,7 +12,7 @@ type TagsProps = {
|
|
|
12
12
|
displayConcept?: ConceptFragment
|
|
13
13
|
genreConcept?: ConceptFragment
|
|
14
14
|
brandConcept?: ConceptFragment
|
|
15
|
-
|
|
15
|
+
hasColumnists?: boolean
|
|
16
16
|
followButtonVariant?: TopperFragment['followButtonVariant']
|
|
17
17
|
FollowButtonSlot?: FollowButtonSlot
|
|
18
18
|
headshot?: string
|
|
@@ -24,7 +24,7 @@ const Tags: React.FC<TagsProps> = ({
|
|
|
24
24
|
displayConcept,
|
|
25
25
|
genreConcept,
|
|
26
26
|
brandConcept,
|
|
27
|
-
|
|
27
|
+
hasColumnists,
|
|
28
28
|
followButtonVariant,
|
|
29
29
|
headshot,
|
|
30
30
|
FollowButtonSlot,
|
|
@@ -33,7 +33,7 @@ const Tags: React.FC<TagsProps> = ({
|
|
|
33
33
|
const concept = getConcept(displayConcept, genreConcept)
|
|
34
34
|
const baseFollowButtonCondition = FollowButtonSlot && concept?.id
|
|
35
35
|
const additionalFollowButtonCondition =
|
|
36
|
-
(isOpinion && !headshot && !
|
|
36
|
+
(isOpinion && !headshot && !hasColumnists) || !isOpinion
|
|
37
37
|
const followButtonCondition =
|
|
38
38
|
baseFollowButtonCondition && additionalFollowButtonCondition
|
|
39
39
|
|
|
@@ -5,7 +5,7 @@ import Headline from './Headline'
|
|
|
5
5
|
import Intro from './Intro'
|
|
6
6
|
import Picture from './Picture'
|
|
7
7
|
import Headshot from '../Headshot'
|
|
8
|
-
import
|
|
8
|
+
import Columnists from './Columnists'
|
|
9
9
|
import LiveBlogIndicator from './LiveBlogIndicator'
|
|
10
10
|
import { FollowButtonSlot } from './FollowButtonSlot'
|
|
11
11
|
import Flourish from '../content-tree/Flourish'
|
|
@@ -65,7 +65,18 @@ const Topper: React.FC<TopperProps> = ({
|
|
|
65
65
|
const hasLayoutWidth = 'layoutWidth' in topper && topper.layoutWidth
|
|
66
66
|
const hasDesign = 'design' in topper && topper.design
|
|
67
67
|
const hasHeadshot = 'headshot' in topper && topper.headshot
|
|
68
|
-
const
|
|
68
|
+
const hasColumnists =
|
|
69
|
+
'columnists' in topper &&
|
|
70
|
+
!!topper.columnists &&
|
|
71
|
+
topper.columnists.length > 0
|
|
72
|
+
const legacyHasColumnist = 'columnist' in topper && !!topper.columnist // @deprecated Replaced with usage of `columinists`
|
|
73
|
+
const hasOneColumnist =
|
|
74
|
+
(hasColumnists && topper.columnists.length === 1) || legacyHasColumnist
|
|
75
|
+
const oneColumnist = hasOneColumnist
|
|
76
|
+
? hasColumnists
|
|
77
|
+
? topper.columnists[0]
|
|
78
|
+
: topper.columnist
|
|
79
|
+
: null
|
|
69
80
|
const sponsorName = 'clientName' in content && content.clientName
|
|
70
81
|
const disclaimerType = isArticle ? content.disclaimerType : undefined
|
|
71
82
|
|
|
@@ -81,8 +92,8 @@ const Topper: React.FC<TopperProps> = ({
|
|
|
81
92
|
modifiers.push(topper.layoutWidth === 'full-grid' ? 'full-grid' : 'in-line')
|
|
82
93
|
|
|
83
94
|
const headshotAltText =
|
|
84
|
-
isOpinion &&
|
|
85
|
-
? `Headshot for ${
|
|
95
|
+
isOpinion && oneColumnist
|
|
96
|
+
? `Headshot for ${oneColumnist.prefLabel}`
|
|
86
97
|
: isPodcast
|
|
87
98
|
? 'Cover photo for podcast'
|
|
88
99
|
: ''
|
|
@@ -161,7 +172,7 @@ const Topper: React.FC<TopperProps> = ({
|
|
|
161
172
|
('genreConcept' in topper && topper.genreConcept) || undefined
|
|
162
173
|
}
|
|
163
174
|
headshot={hasHeadshot || undefined}
|
|
164
|
-
|
|
175
|
+
hasColumnists={hasColumnists}
|
|
165
176
|
followButtonVariant={topper.followButtonVariant}
|
|
166
177
|
FollowButtonSlot={followButtonSlot}
|
|
167
178
|
/>
|
|
@@ -197,19 +208,19 @@ const Topper: React.FC<TopperProps> = ({
|
|
|
197
208
|
source={topper.intro.source}
|
|
198
209
|
/>
|
|
199
210
|
)}
|
|
200
|
-
{hasHeadshot && !isAudio && isOpinion &&
|
|
211
|
+
{hasHeadshot && !isAudio && isOpinion && oneColumnist && (
|
|
201
212
|
<div className="o-topper__headshot">
|
|
202
213
|
<Headshot
|
|
203
214
|
headshot={topper.headshot}
|
|
204
|
-
prefLabel={
|
|
215
|
+
prefLabel={oneColumnist.prefLabel}
|
|
205
216
|
className={'o-topper__headshot-image'}
|
|
206
217
|
altText={headshotAltText}
|
|
207
218
|
/>
|
|
208
219
|
</div>
|
|
209
220
|
)}
|
|
210
|
-
{isOpinion &&
|
|
211
|
-
<
|
|
212
|
-
|
|
221
|
+
{isOpinion && hasColumnists && (
|
|
222
|
+
<Columnists
|
|
223
|
+
authorConcepts={[...topper.columnists]}
|
|
213
224
|
followButtonVariant={topper.followButtonVariant}
|
|
214
225
|
followButtonSlot={followButtonSlot}
|
|
215
226
|
/>
|