@financial-times/cp-content-pipeline-ui 0.1.2
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/.toolkitrc.yml +12 -0
- package/CHANGELOG.md +62 -0
- package/README.md +27 -0
- package/jest.config.mjs +6 -0
- package/lib/components/Body/index.d.ts +8 -0
- package/lib/components/Body/index.js +22 -0
- package/lib/components/Body/index.js.map +1 -0
- package/lib/components/Byline/index.d.ts +7 -0
- package/lib/components/Byline/index.js +12 -0
- package/lib/components/Byline/index.js.map +1 -0
- package/lib/components/ImageSet/index.d.ts +3 -0
- package/lib/components/ImageSet/index.js +64 -0
- package/lib/components/ImageSet/index.js.map +1 -0
- package/lib/components/Layout/index.d.ts +17 -0
- package/lib/components/Layout/index.js +20 -0
- package/lib/components/Layout/index.js.map +1 -0
- package/lib/components/ListItem/index.d.ts +4 -0
- package/lib/components/ListItem/index.js +11 -0
- package/lib/components/ListItem/index.js.map +1 -0
- package/lib/components/Recommended/RecommendedTitle.d.ts +4 -0
- package/lib/components/Recommended/RecommendedTitle.js +11 -0
- package/lib/components/Recommended/RecommendedTitle.js.map +1 -0
- package/lib/components/Recommended/index.d.ts +3 -0
- package/lib/components/Recommended/index.js +16 -0
- package/lib/components/Recommended/index.js.map +1 -0
- package/lib/components/RichText/index.d.ts +16 -0
- package/lib/components/RichText/index.js +112 -0
- package/lib/components/RichText/index.js.map +1 -0
- package/lib/components/RichText/index.test.d.ts +1 -0
- package/lib/components/RichText/index.test.js +170 -0
- package/lib/components/RichText/index.test.js.map +1 -0
- package/lib/components/Topper/Columnist.d.ts +5 -0
- package/lib/components/Topper/Columnist.js +14 -0
- package/lib/components/Topper/Columnist.js.map +1 -0
- package/lib/components/Topper/Headline.d.ts +7 -0
- package/lib/components/Topper/Headline.js +20 -0
- package/lib/components/Topper/Headline.js.map +1 -0
- package/lib/components/Topper/Headshot.d.ts +4 -0
- package/lib/components/Topper/Headshot.js +12 -0
- package/lib/components/Topper/Headshot.js.map +1 -0
- package/lib/components/Topper/Intro.d.ts +7 -0
- package/lib/components/Topper/Intro.js +13 -0
- package/lib/components/Topper/Intro.js.map +1 -0
- package/lib/components/Topper/Picture.d.ts +8 -0
- package/lib/components/Topper/Picture.js +27 -0
- package/lib/components/Topper/Picture.js.map +1 -0
- package/lib/components/Topper/Tags.d.ts +9 -0
- package/lib/components/Topper/Tags.js +24 -0
- package/lib/components/Topper/Tags.js.map +1 -0
- package/lib/components/Topper/Wrapper.d.ts +8 -0
- package/lib/components/Topper/Wrapper.js +20 -0
- package/lib/components/Topper/Wrapper.js.map +1 -0
- package/lib/components/Topper/index.d.ts +7 -0
- package/lib/components/Topper/index.js +39 -0
- package/lib/components/Topper/index.js.map +1 -0
- package/lib/components/UnorderedList/index.d.ts +4 -0
- package/lib/components/UnorderedList/index.js +11 -0
- package/lib/components/UnorderedList/index.js.map +1 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.js +27 -0
- package/lib/index.js.map +1 -0
- package/lib/index.test.d.ts +1 -0
- package/lib/index.test.js +4 -0
- package/lib/index.test.js.map +1 -0
- package/package.json +27 -0
- package/src/components/Body/index.tsx +35 -0
- package/src/components/Byline/index.tsx +12 -0
- package/src/components/ImageSet/index.tsx +123 -0
- package/src/components/Layout/index.tsx +44 -0
- package/src/components/ListItem/index.tsx +5 -0
- package/src/components/Recommended/RecommendedTitle.tsx +9 -0
- package/src/components/Recommended/index.tsx +23 -0
- package/src/components/RichText/README.md +34 -0
- package/src/components/RichText/index.test.tsx +166 -0
- package/src/components/RichText/index.tsx +136 -0
- package/src/components/Topper/Columnist.tsx +21 -0
- package/src/components/Topper/Headline.tsx +27 -0
- package/src/components/Topper/Headshot.tsx +9 -0
- package/src/components/Topper/Intro.tsx +16 -0
- package/src/components/Topper/Picture.tsx +70 -0
- package/src/components/Topper/Tags.tsx +61 -0
- package/src/components/Topper/Wrapper.tsx +26 -0
- package/src/components/Topper/index.tsx +69 -0
- package/src/components/UnorderedList/index.tsx +5 -0
- package/src/index.test.ts +1 -0
- package/src/index.ts +9 -0
- package/src/types/x-teaser.d.ts +1 -0
- package/tsconfig.json +14 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const react_1 = __importStar(require("react"));
|
|
30
|
+
const react_2 = require("@testing-library/react");
|
|
31
|
+
const _1 = __importDefault(require("."));
|
|
32
|
+
describe('<RichText />', () => {
|
|
33
|
+
it('renders a HAST tree using built-in components', () => {
|
|
34
|
+
const tree = {
|
|
35
|
+
type: 'root',
|
|
36
|
+
children: [
|
|
37
|
+
{
|
|
38
|
+
type: 'element',
|
|
39
|
+
tagName: 'Paragraph',
|
|
40
|
+
children: [{ type: 'text', value: 'This is some text.' }],
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
};
|
|
44
|
+
const structuredContent = { tree };
|
|
45
|
+
const { asFragment } = (0, react_2.render)(react_1.default.createElement(_1.default, { structuredContent: structuredContent }));
|
|
46
|
+
expect(asFragment()).toMatchInlineSnapshot(`
|
|
47
|
+
<DocumentFragment>
|
|
48
|
+
<p>
|
|
49
|
+
This is some text.
|
|
50
|
+
</p>
|
|
51
|
+
</DocumentFragment>
|
|
52
|
+
`);
|
|
53
|
+
});
|
|
54
|
+
it('adds a key property to all child components', () => {
|
|
55
|
+
jest.spyOn(react_1.default, 'createElement');
|
|
56
|
+
const tree = {
|
|
57
|
+
type: 'root',
|
|
58
|
+
children: [
|
|
59
|
+
{
|
|
60
|
+
type: 'element',
|
|
61
|
+
tagName: 'Link',
|
|
62
|
+
properties: {
|
|
63
|
+
test: 'blah',
|
|
64
|
+
},
|
|
65
|
+
children: [
|
|
66
|
+
{
|
|
67
|
+
type: 'text',
|
|
68
|
+
value: 'first link',
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
type: 'element',
|
|
74
|
+
tagName: 'Link',
|
|
75
|
+
children: [
|
|
76
|
+
{
|
|
77
|
+
type: 'text',
|
|
78
|
+
value: 'second link',
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
};
|
|
84
|
+
const structuredContent = {
|
|
85
|
+
tree,
|
|
86
|
+
};
|
|
87
|
+
(0, react_2.render)(react_1.default.createElement(_1.default, { structuredContent: structuredContent }));
|
|
88
|
+
expect(react_1.createElement).toHaveBeenCalledWith(expect.any(Function), expect.objectContaining({ key: 0 }), ['first link']);
|
|
89
|
+
expect(react_1.createElement).toHaveBeenCalledWith(expect.any(Function), expect.objectContaining({ key: 1 }), ['second link']);
|
|
90
|
+
});
|
|
91
|
+
it("ignores components that it doesn't have a mapping for", () => {
|
|
92
|
+
const tree = {
|
|
93
|
+
type: 'root',
|
|
94
|
+
children: [
|
|
95
|
+
{
|
|
96
|
+
type: 'element',
|
|
97
|
+
tagName: 'Link',
|
|
98
|
+
properties: {
|
|
99
|
+
test: 'blah',
|
|
100
|
+
},
|
|
101
|
+
children: [
|
|
102
|
+
{
|
|
103
|
+
type: 'text',
|
|
104
|
+
value: 'i should render',
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
type: 'element',
|
|
110
|
+
tagName: 'Unknown',
|
|
111
|
+
children: [
|
|
112
|
+
{
|
|
113
|
+
type: 'text',
|
|
114
|
+
value: 'i should not render',
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
};
|
|
120
|
+
const structuredContent = {
|
|
121
|
+
tree,
|
|
122
|
+
};
|
|
123
|
+
const { queryByText } = (0, react_2.render)(react_1.default.createElement(_1.default, { structuredContent: structuredContent }));
|
|
124
|
+
expect(queryByText('i should render')).toBeTruthy();
|
|
125
|
+
expect(queryByText('i should not render')).toBeFalsy();
|
|
126
|
+
});
|
|
127
|
+
it('adds references as props', () => {
|
|
128
|
+
const tree = {
|
|
129
|
+
type: 'root',
|
|
130
|
+
children: [
|
|
131
|
+
{
|
|
132
|
+
type: 'element',
|
|
133
|
+
tagName: 'Link',
|
|
134
|
+
properties: {
|
|
135
|
+
dataReferenceId: 0,
|
|
136
|
+
},
|
|
137
|
+
children: [
|
|
138
|
+
{
|
|
139
|
+
type: 'text',
|
|
140
|
+
value: 'withreference',
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
type: 'element',
|
|
146
|
+
tagName: 'Link',
|
|
147
|
+
children: [
|
|
148
|
+
{
|
|
149
|
+
type: 'text',
|
|
150
|
+
value: 'withoutreference',
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
};
|
|
156
|
+
const structuredContent = {
|
|
157
|
+
tree,
|
|
158
|
+
references: [
|
|
159
|
+
{
|
|
160
|
+
__typename: 'Link',
|
|
161
|
+
href: 'https://www.ft.com/',
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
};
|
|
165
|
+
const { getByText } = (0, react_2.render)(react_1.default.createElement(_1.default, { structuredContent: structuredContent }));
|
|
166
|
+
expect(getByText('withreference')).toHaveProperty('href', 'https://www.ft.com/');
|
|
167
|
+
expect(getByText('withoutreference')).toHaveProperty('href', '');
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
//# sourceMappingURL=index.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../src/components/RichText/index.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA4C;AAC5C,kDAA+C;AAC/C,yCAAwB;AAExB,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,MAAM,IAAI,GAAG;YACX,IAAI,EAAE,MAAgB;YACtB,QAAQ,EAAE;gBACR;oBACE,IAAI,EAAE,SAAsB;oBAC5B,OAAO,EAAE,WAAW;oBACpB,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,MAAgB,EAAE,KAAK,EAAE,oBAAoB,EAAE,CAAC;iBACpE;aACF;SACF,CAAA;QACD,MAAM,iBAAiB,GAAG,EAAE,IAAI,EAAE,CAAA;QAElC,MAAM,EAAE,UAAU,EAAE,GAAG,IAAA,cAAM,EAC3B,8BAAC,UAAQ,IAAC,iBAAiB,EAAE,iBAAiB,G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,EAAE,kBAAkB;yBAC1B;qBACF;iBACF;aACF;SACF,CAAA;QACD,MAAM,iBAAiB,GAAG;YACxB,IAAI;YACJ,UAAU,EAAE;gBACV;oBACE,UAAU,EAAE,MAAe;oBAC3B,IAAI,EAAE,qBAAqB;iBAC5B;aACF;SACF,CAAA;QAED,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,cAAM,EAC1B,8BAAC,UAAQ,IAAC,iBAAiB,EAAE,iBAAiB,GAAI,CACnD,CAAA;QACD,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC,cAAc,CAC/C,MAAM,EACN,qBAAqB,CACtB,CAAA;QACD,MAAM,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;IAClE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
//TODO: add myFT button stuff here
|
|
8
|
+
function Columnist({ authorConcept, }) {
|
|
9
|
+
var _a;
|
|
10
|
+
return (react_1.default.createElement("div", { className: "o-topper__columnist" },
|
|
11
|
+
react_1.default.createElement("a", { className: "o-topper__columnist-name n-content-tag--with-follow", href: (_a = authorConcept.relativeUrl) !== null && _a !== void 0 ? _a : undefined, "data-trackable": "columnist" }, authorConcept.prefLabel)));
|
|
12
|
+
}
|
|
13
|
+
exports.default = Columnist;
|
|
14
|
+
//# sourceMappingURL=Columnist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Columnist.js","sourceRoot":"","sources":["../../../src/components/Topper/Columnist.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AAGzB,kCAAkC;AAClC,SAAwB,SAAS,CAAC,EAChC,aAAa,GAGd;;IACC,OAAO,CACL,uCAAK,SAAS,EAAC,qBAAqB;QAClC,qCACE,SAAS,EAAC,qDAAqD,EAC/D,IAAI,EAAE,MAAA,aAAa,CAAC,WAAW,mCAAI,SAAS,oBAC7B,WAAW,IAEzB,aAAa,CAAC,SAAS,CACtB,CACA,CACP,CAAA;AACH,CAAC;AAhBD,4BAgBC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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 classnames_1 = __importDefault(require("classnames"));
|
|
8
|
+
function Headline({ headline, isLargeHeadline = false, }) {
|
|
9
|
+
if (!headline) {
|
|
10
|
+
return react_1.default.createElement(react_1.default.Fragment, null);
|
|
11
|
+
}
|
|
12
|
+
const headlineClassnames = (0, classnames_1.default)({
|
|
13
|
+
'o-topper__headline': true,
|
|
14
|
+
[`o-topper__headline--large`]: isLargeHeadline,
|
|
15
|
+
});
|
|
16
|
+
return (react_1.default.createElement("h1", { className: headlineClassnames },
|
|
17
|
+
react_1.default.createElement("span", { className: "article-classifier__gap" }, headline)));
|
|
18
|
+
}
|
|
19
|
+
exports.default = Headline;
|
|
20
|
+
//# sourceMappingURL=Headline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Headline.js","sourceRoot":"","sources":["../../../src/components/Topper/Headline.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AACzB,4DAAmC;AAOnC,SAAwB,QAAQ,CAAC,EAC/B,QAAQ,EACR,eAAe,GAAG,KAAK,GACT;IACd,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO,6DAAK,CAAA;KACb;IAED,MAAM,kBAAkB,GAAG,IAAA,oBAAU,EAAC;QACpC,oBAAoB,EAAE,IAAI;QAC1B,CAAC,2BAA2B,CAAC,EAAE,eAAe;KAC/C,CAAC,CAAA;IAEF,OAAO,CACL,sCAAI,SAAS,EAAE,kBAAkB;QAC/B,wCAAM,SAAS,EAAC,yBAAyB,IAAE,QAAQ,CAAQ,CACxD,CACN,CAAA;AACH,CAAC;AAlBD,2BAkBC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
function Headshot({ url }) {
|
|
8
|
+
return (react_1.default.createElement("div", { className: "o-topper__headshot" },
|
|
9
|
+
react_1.default.createElement("img", { className: "o-topper__headshot-image", src: url, role: "presentation" })));
|
|
10
|
+
}
|
|
11
|
+
exports.default = Headshot;
|
|
12
|
+
//# sourceMappingURL=Headshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Headshot.js","sourceRoot":"","sources":["../../../src/components/Topper/Headshot.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AAEzB,SAAwB,QAAQ,CAAC,EAAE,GAAG,EAAmB;IACvD,OAAO,CACL,uCAAK,SAAS,EAAC,oBAAoB;QACjC,uCAAK,SAAS,EAAC,0BAA0B,EAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAC,cAAc,GAAG,CACtE,CACP,CAAA;AACH,CAAC;AAND,2BAMC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { StructuredTreeFragment } from '@financial-times/cp-content-pipeline-client';
|
|
3
|
+
export declare type IntroProps = {
|
|
4
|
+
source: 'standfirst' | 'summary';
|
|
5
|
+
structuredContent: StructuredTreeFragment;
|
|
6
|
+
};
|
|
7
|
+
export default function Intro({ structuredContent, source }: IntroProps): JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
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 RichText_1 = __importDefault(require("../RichText"));
|
|
8
|
+
function Intro({ structuredContent, source }) {
|
|
9
|
+
return (react_1.default.createElement("div", { className: `o-topper__${source}` },
|
|
10
|
+
react_1.default.createElement(RichText_1.default, { structuredContent: structuredContent })));
|
|
11
|
+
}
|
|
12
|
+
exports.default = Intro;
|
|
13
|
+
//# sourceMappingURL=Intro.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Intro.js","sourceRoot":"","sources":["../../../src/components/Topper/Intro.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AACzB,2DAAkC;AAQlC,SAAwB,KAAK,CAAC,EAAE,iBAAiB,EAAE,MAAM,EAAc;IACrE,OAAO,CACL,uCAAK,SAAS,EAAE,aAAa,MAAM,EAAE;QACnC,8BAAC,kBAAQ,IAAC,iBAAiB,EAAE,iBAAiB,GAAI,CAC9C,CACP,CAAA;AACH,CAAC;AAND,wBAMC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TopperImagesFragment } from '@financial-times/cp-content-pipeline-client';
|
|
3
|
+
declare type PictureProps = {
|
|
4
|
+
images?: TopperImagesFragment;
|
|
5
|
+
alt?: string;
|
|
6
|
+
};
|
|
7
|
+
export default function Picture({ images, alt }: PictureProps): JSX.Element | null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
function generateMediaQuery(image) {
|
|
8
|
+
const queries = [];
|
|
9
|
+
image.minDisplayWidth && queries.push(`(min-width: ${image.minDisplayWidth})`);
|
|
10
|
+
image.maxDisplayWidth && queries.push(`(max-width: ${image.maxDisplayWidth})`);
|
|
11
|
+
return queries.join(' and ');
|
|
12
|
+
}
|
|
13
|
+
const srcSet = (image) => image.sources.map((src) => `${src.url} ${src.dpr}x`).join(',');
|
|
14
|
+
function Picture({ images, alt = '' }) {
|
|
15
|
+
if (!(images === null || images === void 0 ? void 0 : images.fallback)) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
return (react_1.default.createElement("figure", { className: "o-topper__visual" },
|
|
19
|
+
react_1.default.createElement("picture", { className: "o-topper__picture", key: "responsive-images" },
|
|
20
|
+
(images === null || images === void 0 ? void 0 : images.square) && (react_1.default.createElement("source", { media: generateMediaQuery(images.square), srcSet: srcSet(images.square), "data-testid": "responsive-source", key: 'square' })),
|
|
21
|
+
(images === null || images === void 0 ? void 0 : images.standard) && (react_1.default.createElement("source", { media: generateMediaQuery(images.standard), srcSet: srcSet(images.standard), "data-testid": "responsive-source", key: 'standard' })),
|
|
22
|
+
(images === null || images === void 0 ? void 0 : images.wide) && (react_1.default.createElement("source", { media: generateMediaQuery(images.wide), srcSet: srcSet(images.wide), "data-testid": "responsive-source", key: 'standard' })),
|
|
23
|
+
react_1.default.createElement("img", { alt: alt, className: "o-topper__image", src: `${images.fallback.sources[0].url}`, key: "fallback-image" })),
|
|
24
|
+
images.fallback.copyright && (react_1.default.createElement("figcaption", { className: "o-topper__image-credit" }, images.fallback.copyright))));
|
|
25
|
+
}
|
|
26
|
+
exports.default = Picture;
|
|
27
|
+
//# sourceMappingURL=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uBAAN,MAAM,CAAE,QAAQ,KAAI,CACnB,0CACE,KAAK,EAAE,kBAAkB,CAAC,MAAM,CAAC,QAAQ,CAAC,EAC1C,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,iBACnB,mBAAmB,EAC/B,GAAG,EAAE,UAAU,GACf,CACH;YACA,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,KAAI,CACf,0CACE,KAAK,EAAE,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,EACtC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,iBACf,mBAAmB,EAC/B,GAAG,EAAE,UAAU,GACf,CACH;YACD,uCACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAC,iBAAiB,EAC3B,GAAG,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,EACxC,GAAG,EAAC,gBAAgB,GACpB,CACM;QACT,MAAM,CAAC,QAAQ,CAAC,SAAS,IAAI,CAC5B,8CAAY,SAAS,EAAC,wBAAwB,IAC3C,MAAM,CAAC,QAAQ,CAAC,SAAS,CACf,CACd,CACM,CACV,CAAA;AACH,CAAC;AA9CD,0BA8CC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ConceptFragment } from '@financial-times/cp-content-pipeline-client';
|
|
3
|
+
declare type TagsProps = {
|
|
4
|
+
__typename: String;
|
|
5
|
+
displayConcept?: ConceptFragment;
|
|
6
|
+
brandConcept?: ConceptFragment;
|
|
7
|
+
};
|
|
8
|
+
export default function Tags({ __typename, displayConcept, brandConcept, }: TagsProps): JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
function Tags({ __typename, displayConcept, brandConcept, }) {
|
|
8
|
+
var _a;
|
|
9
|
+
//TODO: add back follow buttons here
|
|
10
|
+
return (react_1.default.createElement("div", { className: "o-topper__tags" },
|
|
11
|
+
react_1.default.createElement("div", { className: "topper__primary-theme" },
|
|
12
|
+
__typename === 'OpinionTopper' && (react_1.default.createElement("span", { className: "o-topper__opinion-genre", "aria-label": "opinion article" }, `Opinion `)),
|
|
13
|
+
brandConcept && (react_1.default.createElement("a", { href: (_a = brandConcept.relativeUrl) !== null && _a !== void 0 ? _a : undefined, className: "o-topper__brand", "data-trackable": "primary-brand", "aria-label": `part of the ${brandConcept.prefLabel} column` },
|
|
14
|
+
brandConcept.prefLabel,
|
|
15
|
+
" \u00A0")),
|
|
16
|
+
displayConcept && displayConcept.id && (react_1.default.createElement("span", null,
|
|
17
|
+
' ',
|
|
18
|
+
react_1.default.createElement(ConceptLabel, { ...displayConcept }))))));
|
|
19
|
+
}
|
|
20
|
+
exports.default = Tags;
|
|
21
|
+
function ConceptLabel(concept) {
|
|
22
|
+
return (react_1.default.createElement("a", { href: concept.relativeUrl, className: "o-topper__topic n-content-tag--with-follow js-primary-theme", "data-trackable": "primary-theme", "aria-label": `posted in category ${concept.prefLabel}`, "data-concept-id": concept.id }, concept.prefLabel));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=Tags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tags.js","sourceRoot":"","sources":["../../../src/components/Topper/Tags.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AASzB,SAAwB,IAAI,CAAC,EAC3B,UAAU,EACV,cAAc,EACd,YAAY,GACF;;IACV,oCAAoC;IACpC,OAAO,CACL,uCAAK,SAAS,EAAC,gBAAgB;QAC7B,uCAAK,SAAS,EAAC,uBAAuB;YACnC,UAAU,KAAK,eAAe,IAAI,CACjC,wCACE,SAAS,EAAC,yBAAyB,gBACxB,iBAAiB,IAE3B,UAAU,CACN,CACR;YAEA,YAAY,IAAI,CACf,qCACE,IAAI,EAAE,MAAA,YAAY,CAAC,WAAW,mCAAI,SAAS,EAC3C,SAAS,EAAC,iBAAiB,oBACZ,eAAe,gBAClB,eAAe,YAAY,CAAC,SAAS,SAAS;gBAEzD,YAAY,CAAC,SAAS;0BACrB,CACL;YACA,cAAc,IAAI,cAAc,CAAC,EAAE,IAAI,CACtC;gBACG,GAAG;gBACJ,8BAAC,YAAY,OAAK,cAAc,GAAI,CAC/B,CACR,CACG,CACF,CACP,CAAA;AACH,CAAC;AArCD,uBAqCC;AAED,SAAS,YAAY,CAAC,OAAwB;IAC5C,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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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 classnames_1 = __importDefault(require("classnames"));
|
|
8
|
+
function Wrapper({ children, modifiers = [], backgroundColor, }) {
|
|
9
|
+
const modifierClasses = modifiers.map((modifier) => `o-topper--${modifier}`);
|
|
10
|
+
const modifierClassesString = modifierClasses.toString().replace(/,/g, ' ');
|
|
11
|
+
const wrapperClassnames = (0, classnames_1.default)({
|
|
12
|
+
'o-topper': true,
|
|
13
|
+
'article-topper': true,
|
|
14
|
+
[`o-topper--color-${backgroundColor}`]: Boolean(backgroundColor),
|
|
15
|
+
[`${modifierClassesString}`]: Boolean(modifierClassesString),
|
|
16
|
+
});
|
|
17
|
+
return react_1.default.createElement("div", { className: wrapperClassnames }, children);
|
|
18
|
+
}
|
|
19
|
+
exports.default = Wrapper;
|
|
20
|
+
//# sourceMappingURL=Wrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Wrapper.js","sourceRoot":"","sources":["../../../src/components/Topper/Wrapper.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAwC;AACxC,4DAAmC;AAQnC,SAAwB,OAAO,CAAC,EAC9B,QAAQ,EACR,SAAS,GAAG,EAAE,EACd,eAAe,GACF;IACb,MAAM,eAAe,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,aAAa,QAAQ,EAAE,CAAC,CAAA;IAC5E,MAAM,qBAAqB,GAAG,eAAe,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAE3E,MAAM,iBAAiB,GAAG,IAAA,oBAAU,EAAC;QACnC,UAAU,EAAE,IAAI;QAChB,gBAAgB,EAAE,IAAI;QACtB,CAAC,mBAAmB,eAAe,EAAE,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC;QAChE,CAAC,GAAG,qBAAqB,EAAE,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC;KAC7D,CAAC,CAAA;IAEF,OAAO,uCAAK,SAAS,EAAE,iBAAiB,IAAG,QAAQ,CAAO,CAAA;AAC5D,CAAC;AAhBD,0BAgBC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ArticleQuery } from '@financial-times/cp-content-pipeline-client';
|
|
3
|
+
declare type TopperProps = {
|
|
4
|
+
content: ArticleQuery['content'];
|
|
5
|
+
};
|
|
6
|
+
export default function Topper({ content }: TopperProps): JSX.Element | null;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
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 Wrapper_js_1 = __importDefault(require("./Wrapper.js"));
|
|
8
|
+
const Tags_js_1 = __importDefault(require("./Tags.js"));
|
|
9
|
+
const Headline_js_1 = __importDefault(require("./Headline.js"));
|
|
10
|
+
const Intro_js_1 = __importDefault(require("./Intro.js"));
|
|
11
|
+
const Picture_js_1 = __importDefault(require("./Picture.js"));
|
|
12
|
+
const Headshot_js_1 = __importDefault(require("./Headshot.js"));
|
|
13
|
+
const Columnist_js_1 = __importDefault(require("./Columnist.js"));
|
|
14
|
+
const index_js_1 = __importDefault(require("../Byline/index.js"));
|
|
15
|
+
function Topper({ content }) {
|
|
16
|
+
const { topper } = content;
|
|
17
|
+
if (!topper) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const modifiers = [];
|
|
21
|
+
'layout' in topper && topper.layout && modifiers.push(topper.layout);
|
|
22
|
+
'headshot' in topper && topper.headshot && modifiers.push('has-headshot');
|
|
23
|
+
topper.__typename === 'OpinionTopper' && modifiers.push('opinion');
|
|
24
|
+
return (react_1.default.createElement("div", { className: "article-topper" },
|
|
25
|
+
react_1.default.createElement(Wrapper_js_1.default, { backgroundColor: topper.backgroundColour, modifiers: modifiers },
|
|
26
|
+
react_1.default.createElement("div", { className: "o-topper__content", id: "o-topper" },
|
|
27
|
+
react_1.default.createElement(Tags_js_1.default, { __typename: topper.__typename, displayConcept: topper.displayConcept, brandConcept: topper.__typename === 'BrandedTopper'
|
|
28
|
+
? topper.brandConcept
|
|
29
|
+
: undefined }),
|
|
30
|
+
react_1.default.createElement(Headline_js_1.default, { headline: topper.headline, isLargeHeadline: 'isLargeHeadline' in topper && topper.isLargeHeadline }),
|
|
31
|
+
react_1.default.createElement(index_js_1.default, { structuredContent: content.byline }),
|
|
32
|
+
topper.intro && (react_1.default.createElement(Intro_js_1.default, { structuredContent: topper.intro.structured, source: topper.intro.source })),
|
|
33
|
+
'headshot' in topper && topper.headshot && (react_1.default.createElement(Headshot_js_1.default, { url: topper.headshot })),
|
|
34
|
+
topper.__typename === 'OpinionTopper' && topper.columnist && (react_1.default.createElement(Columnist_js_1.default, { authorConcept: topper.columnist }))),
|
|
35
|
+
react_1.default.createElement("div", { className: "o-topper__background" }),
|
|
36
|
+
'images' in topper && react_1.default.createElement(Picture_js_1.default, { images: topper.images }))));
|
|
37
|
+
}
|
|
38
|
+
exports.default = Topper;
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Topper/index.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AACzB,8DAAkC;AAClC,wDAA4B;AAC5B,gEAAoC;AACpC,0DAA8B;AAC9B,8DAAkC;AAClC,gEAAoC;AACpC,kEAAsC;AACtC,kEAAuC;AAQvC,SAAwB,MAAM,CAAC,EAAE,OAAO,EAAe;IACrD,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAA;IAE1B,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,IAAI,CAAA;KACZ;IAED,MAAM,SAAS,GAAa,EAAE,CAAA;IAE9B,QAAQ,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,IAAI,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IACpE,UAAU,IAAI,MAAM,IAAI,MAAM,CAAC,QAAQ,IAAI,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;IACzE,MAAM,CAAC,UAAU,KAAK,eAAe,IAAI,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IAElE,OAAO,CACL,uCAAK,SAAS,EAAC,gBAAgB;QAC7B,8BAA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|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
function UnorderedList({ children }) {
|
|
8
|
+
return react_1.default.createElement("ul", null, children);
|
|
9
|
+
}
|
|
10
|
+
exports.default = UnorderedList;
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/UnorderedList/index.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAwC;AAExC,SAAwB,aAAa,CAAC,EAAE,QAAQ,EAA2B;IACzE,OAAO,0CAAK,QAAQ,CAAM,CAAA;AAC5B,CAAC;AAFD,gCAEC"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { default as Body } from './components/Body';
|
|
2
|
+
export { default as Topper } from './components/Topper';
|
|
3
|
+
export { default as Byline } from './components/Byline';
|
|
4
|
+
export { default as ImageSet } from './components/ImageSet';
|
|
5
|
+
export { Layout, LayoutContainer, LayoutSlot } from './components/Layout';
|
|
6
|
+
export { default as UnorderedList } from './components/UnorderedList';
|
|
7
|
+
export { default as ListItem } from './components/ListItem';
|
|
8
|
+
export { default as Recommended } from './components/Recommended';
|
|
9
|
+
export { default as RichText } from './components/RichText';
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
exports.RichText = exports.Recommended = exports.ListItem = exports.UnorderedList = exports.LayoutSlot = exports.LayoutContainer = exports.Layout = exports.ImageSet = exports.Byline = exports.Topper = exports.Body = void 0;
|
|
7
|
+
var Body_1 = require("./components/Body");
|
|
8
|
+
Object.defineProperty(exports, "Body", { enumerable: true, get: function () { return __importDefault(Body_1).default; } });
|
|
9
|
+
var Topper_1 = require("./components/Topper");
|
|
10
|
+
Object.defineProperty(exports, "Topper", { enumerable: true, get: function () { return __importDefault(Topper_1).default; } });
|
|
11
|
+
var Byline_1 = require("./components/Byline");
|
|
12
|
+
Object.defineProperty(exports, "Byline", { enumerable: true, get: function () { return __importDefault(Byline_1).default; } });
|
|
13
|
+
var ImageSet_1 = require("./components/ImageSet");
|
|
14
|
+
Object.defineProperty(exports, "ImageSet", { enumerable: true, get: function () { return __importDefault(ImageSet_1).default; } });
|
|
15
|
+
var Layout_1 = require("./components/Layout");
|
|
16
|
+
Object.defineProperty(exports, "Layout", { enumerable: true, get: function () { return Layout_1.Layout; } });
|
|
17
|
+
Object.defineProperty(exports, "LayoutContainer", { enumerable: true, get: function () { return Layout_1.LayoutContainer; } });
|
|
18
|
+
Object.defineProperty(exports, "LayoutSlot", { enumerable: true, get: function () { return Layout_1.LayoutSlot; } });
|
|
19
|
+
var UnorderedList_1 = require("./components/UnorderedList");
|
|
20
|
+
Object.defineProperty(exports, "UnorderedList", { enumerable: true, get: function () { return __importDefault(UnorderedList_1).default; } });
|
|
21
|
+
var ListItem_1 = require("./components/ListItem");
|
|
22
|
+
Object.defineProperty(exports, "ListItem", { enumerable: true, get: function () { return __importDefault(ListItem_1).default; } });
|
|
23
|
+
var Recommended_1 = require("./components/Recommended");
|
|
24
|
+
Object.defineProperty(exports, "Recommended", { enumerable: true, get: function () { return __importDefault(Recommended_1).default; } });
|
|
25
|
+
var RichText_1 = require("./components/RichText");
|
|
26
|
+
Object.defineProperty(exports, "RichText", { enumerable: true, get: function () { return __importDefault(RichText_1).default; } });
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,0CAAmD;AAA1C,6GAAA,OAAO,OAAQ;AACxB,8CAAuD;AAA9C,iHAAA,OAAO,OAAU;AAC1B,8CAAuD;AAA9C,iHAAA,OAAO,OAAU;AAC1B,kDAA2D;AAAlD,qHAAA,OAAO,OAAY;AAC5B,8CAAyE;AAAhE,gGAAA,MAAM,OAAA;AAAE,yGAAA,eAAe,OAAA;AAAE,oGAAA,UAAU,OAAA;AAC5C,4DAAqE;AAA5D,+HAAA,OAAO,OAAiB;AACjC,kDAA2D;AAAlD,qHAAA,OAAO,OAAY;AAC5B,wDAAiE;AAAxD,2HAAA,OAAO,OAAe;AAC/B,kDAA2D;AAAlD,qHAAA,OAAO,OAAY"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":";;AAAA,IAAI,CAAC,kBAAkB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@financial-times/cp-content-pipeline-ui",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "dotcom-tool-kit build:local",
|
|
8
|
+
"test": "dotcom-tool-kit test:local",
|
|
9
|
+
"start": "dotcom-tool-kit run:local"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [],
|
|
12
|
+
"license": "ISC",
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@dotcom-tool-kit/npm": "^2.0.9",
|
|
15
|
+
"@financial-times/cp-content-pipeline-client": "^0.2.1",
|
|
16
|
+
"@testing-library/react": "^13.3.0",
|
|
17
|
+
"@types/hast": "^2.3.4",
|
|
18
|
+
"@types/react": "^18.0.15",
|
|
19
|
+
"eslint-plugin-react": "^7.30.1"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@financial-times/o-teaser": "^6.2.2",
|
|
23
|
+
"@financial-times/x-teaser": "^8.0.3",
|
|
24
|
+
"classnames": "^2.3.1",
|
|
25
|
+
"react": "^18.2.0"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import RichText from '../RichText'
|
|
3
|
+
|
|
4
|
+
import type { ArticleQuery } from '@financial-times/cp-content-pipeline-client'
|
|
5
|
+
import type { ComponentMapRecord } from '../RichText/index.js'
|
|
6
|
+
|
|
7
|
+
export type BodyProps = {
|
|
8
|
+
content: ArticleQuery['content']
|
|
9
|
+
components: ComponentMapRecord
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default function Body({ content, components }: BodyProps) {
|
|
13
|
+
if (!content?.body?.structured) {
|
|
14
|
+
return null
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<div className="article-content">
|
|
19
|
+
<article id="site-content" className="article article-grid">
|
|
20
|
+
<div className="article__content">
|
|
21
|
+
<div className="article__content-body n-content-body js-article__content-body">
|
|
22
|
+
<div className="article__content-body n-content-body js-article__content-body">
|
|
23
|
+
<article className="n-content-body">
|
|
24
|
+
<RichText
|
|
25
|
+
structuredContent={content.body.structured}
|
|
26
|
+
components={components}
|
|
27
|
+
/>
|
|
28
|
+
</article>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</article>
|
|
33
|
+
</div>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {StructuredTreeFragment} from "@financial-times/cp-content-pipeline-client";
|
|
3
|
+
|
|
4
|
+
import RichText from "../RichText/index.js";
|
|
5
|
+
|
|
6
|
+
type BylineProps = {
|
|
7
|
+
structuredContent: StructuredTreeFragment
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default function Byline({ structuredContent }: BylineProps) {
|
|
11
|
+
return <RichText structuredContent={structuredContent} />
|
|
12
|
+
}
|