@financial-times/cp-content-pipeline-ui 0.4.0 → 0.5.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 +66 -0
- package/README.md +27 -19
- package/lib/components/ArticleBody/index.js +1 -2
- package/lib/components/ArticleBody/index.js.map +1 -1
- package/lib/components/ArticleInfo/index.d.ts +2 -2
- package/lib/components/ArticleInfo/index.js +3 -2
- package/lib/components/ArticleInfo/index.js.map +1 -1
- package/lib/components/Body/index.js +5 -4
- package/lib/components/Body/index.js.map +1 -1
- package/lib/components/Byline/index.js +5 -1
- package/lib/components/Byline/index.js.map +1 -1
- package/lib/components/Flourish/index.d.ts +2 -1
- package/lib/components/Flourish/index.js +5 -4
- package/lib/components/Flourish/index.js.map +1 -1
- package/lib/components/Heading/index.d.ts +6 -0
- package/lib/components/Heading/index.js +17 -0
- package/lib/components/Heading/index.js.map +1 -0
- package/lib/components/ImageSet/index.d.ts +20 -2
- package/lib/components/ImageSet/index.js +50 -48
- package/lib/components/ImageSet/index.js.map +1 -1
- package/lib/components/Layout/index.d.ts +14 -12
- package/lib/components/Layout/index.js +5 -4
- package/lib/components/Layout/index.js.map +1 -1
- package/lib/components/LiveBlogBody/index.js +2 -5
- package/lib/components/LiveBlogBody/index.js.map +1 -1
- package/lib/components/MainImage/index.js +2 -3
- package/lib/components/MainImage/index.js.map +1 -1
- package/lib/components/Pullquote/index.d.ts +4 -0
- package/lib/components/Pullquote/index.js +10 -0
- package/lib/components/Pullquote/index.js.map +1 -0
- package/lib/components/Recommended/index.d.ts +2 -2
- package/lib/components/Recommended/index.js +2 -4
- package/lib/components/Recommended/index.js.map +1 -1
- package/lib/components/RichText/BasicComponents.d.ts +10 -12
- package/lib/components/RichText/BasicComponents.js +6 -12
- package/lib/components/RichText/BasicComponents.js.map +1 -1
- package/lib/components/RichText/index.d.ts +3 -3
- package/lib/components/RichText/index.js +48 -56
- package/lib/components/RichText/index.js.map +1 -1
- package/lib/components/RichText/index.test.js +31 -66
- package/lib/components/RichText/index.test.js.map +1 -1
- package/lib/components/Topper/Columnist.js +1 -2
- package/lib/components/Topper/Columnist.js.map +1 -1
- package/lib/components/Topper/Picture.d.ts +3 -3
- package/lib/components/Topper/Picture.js +26 -14
- package/lib/components/Topper/Picture.js.map +1 -1
- package/lib/components/Topper/Tags.js +1 -2
- package/lib/components/Topper/Tags.js.map +1 -1
- package/lib/components/Topper/index.js +1 -1
- package/lib/components/Topper/index.js.map +1 -1
- package/lib/components/Tweet/index.d.ts +2 -1
- package/lib/components/Tweet/index.js +5 -9
- package/lib/components/Tweet/index.js.map +1 -1
- package/lib/index.d.ts +4 -3
- package/lib/index.js +8 -9
- package/lib/index.js.map +1 -1
- package/lib/index.test.js +1 -0
- package/lib/index.test.js.map +1 -1
- package/package.json +8 -6
- package/src/components/ArticleInfo/index.tsx +4 -2
- package/src/components/Body/index.tsx +5 -2
- package/src/components/Byline/index.tsx +14 -1
- package/src/components/Flourish/index.tsx +57 -44
- package/src/components/Heading/index.tsx +14 -0
- package/src/components/ImageSet/index.tsx +126 -85
- package/src/components/Layout/index.tsx +18 -20
- package/src/components/LiveBlogBody/index.tsx +8 -13
- package/src/components/MainImage/index.tsx +3 -2
- package/src/components/Pullquote/index.tsx +12 -0
- package/src/components/Recommended/index.tsx +7 -12
- package/src/components/RichText/BasicComponents.tsx +36 -18
- package/src/components/RichText/index.test.tsx +48 -82
- package/src/components/RichText/index.tsx +60 -71
- package/src/components/Topper/Picture.tsx +35 -42
- package/src/components/Topper/index.tsx +1 -1
- package/src/components/Tweet/index.tsx +8 -13
- package/src/index.test.ts +1 -0
- package/src/index.ts +4 -6
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/components/PullQuote/index.d.ts +0 -3
- package/lib/components/PullQuote/index.js +0 -14
- package/lib/components/PullQuote/index.js.map +0 -1
- package/lib/components/Recommended/RecommendedTitle.d.ts +0 -4
- package/lib/components/Recommended/RecommendedTitle.js +0 -11
- package/lib/components/Recommended/RecommendedTitle.js.map +0 -1
- package/src/components/PullQuote/index.tsx +0 -18
- package/src/components/Recommended/RecommendedTitle.tsx +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -66,6 +66,72 @@
|
|
|
66
66
|
* devDependencies
|
|
67
67
|
* @financial-times/cp-content-pipeline-client bumped from ^0.3.7 to ^0.3.8
|
|
68
68
|
|
|
69
|
+
## [0.5.0](https://github.com/Financial-Times/cp-content-pipeline/compare/cp-content-pipeline-ui-v0.4.0...cp-content-pipeline-ui-v0.5.0) (2023-01-24)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
### ⚠ BREAKING CHANGES
|
|
73
|
+
|
|
74
|
+
* don't automatically serialise live blog body
|
|
75
|
+
* update to latest content-tree ImageSet changes
|
|
76
|
+
* update references to use External type
|
|
77
|
+
* use contenttree for structured tree
|
|
78
|
+
* return an array for picture images
|
|
79
|
+
* rename sources on Image to sourceSet
|
|
80
|
+
|
|
81
|
+
### Features
|
|
82
|
+
|
|
83
|
+
* add Flourish to content-tree ([7816a6f](https://github.com/Financial-Times/cp-content-pipeline/commit/7816a6f5b4d9f599ebd4afd9284de5b18979f278))
|
|
84
|
+
* add imageset to references ([28157c0](https://github.com/Financial-Times/cp-content-pipeline/commit/28157c0e170a4d954ff8ab97decd89221b1a0545))
|
|
85
|
+
* add layout nodes to content tree ([b6f5327](https://github.com/Financial-Times/cp-content-pipeline/commit/b6f5327422521437ae18f88f6100e1fcfa1f8cb4))
|
|
86
|
+
* add recommended link to content tree ([082450a](https://github.com/Financial-Times/cp-content-pipeline/commit/082450acf36e3ce2bd51893e3ebfd8c62fe20f0b))
|
|
87
|
+
* add some more tags ([0bb0b6f](https://github.com/Financial-Times/cp-content-pipeline/commit/0bb0b6fd2dae1d9ffaa2d19028a49231c8a89217))
|
|
88
|
+
* add tweet reference to content tree ([d0d0550](https://github.com/Financial-Times/cp-content-pipeline/commit/d0d05504ad0cc105507d6c8f9145dee23afc8f28))
|
|
89
|
+
* allow overriding article & live blog bodies ([7387cd8](https://github.com/Financial-Times/cp-content-pipeline/commit/7387cd8527238121d859b00099dbc9945175adf1))
|
|
90
|
+
* don't automatically serialise live blog body ([bdb6976](https://github.com/Financial-Times/cp-content-pipeline/commit/bdb6976c4c18bbec1f4ebc3420fca5388817cf43))
|
|
91
|
+
* rename sources on Image to sourceSet ([c6ddf7f](https://github.com/Financial-Times/cp-content-pipeline/commit/c6ddf7f0cac47b0cbf4060e91c62a1c398665058))
|
|
92
|
+
* render new image data format in imageset component ([6016216](https://github.com/Financial-Times/cp-content-pipeline/commit/60162163812a16a0e7a8728c49dfde4b85dca338))
|
|
93
|
+
* render raw images ([3cf9cb6](https://github.com/Financial-Times/cp-content-pipeline/commit/3cf9cb69199e31fde4b23935d7e2ddf7bdbdf916))
|
|
94
|
+
* render topper image using imageset components ([687b31c](https://github.com/Financial-Times/cp-content-pipeline/commit/687b31c57cfc5e32ac0e2517dfc5df81e0a64952))
|
|
95
|
+
* return an array for picture images ([e555bf8](https://github.com/Financial-Times/cp-content-pipeline/commit/e555bf8e33e4c2f23957aa2ed463395bae21e8a6))
|
|
96
|
+
* return array for topper images ([826e6cf](https://github.com/Financial-Times/cp-content-pipeline/commit/826e6cfc47b2782e5a7a7dfe4a12f81d21d08fcb))
|
|
97
|
+
* update x-live-blog-wrapper and pass it the RichText component ([b822cf3](https://github.com/Financial-Times/cp-content-pipeline/commit/b822cf37cef743baca1761fb12d6680500a457a1))
|
|
98
|
+
* use contenttree for structured tree ([0bb0b6f](https://github.com/Financial-Times/cp-content-pipeline/commit/0bb0b6fd2dae1d9ffaa2d19028a49231c8a89217))
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
### Bug Fixes
|
|
102
|
+
|
|
103
|
+
* broken tests and image format bug ([82909a8](https://github.com/Financial-Times/cp-content-pipeline/commit/82909a88cca976eb2bf1c8114ca4c93eb0d9da8d))
|
|
104
|
+
* casing of Pullquote folder ([fa44f99](https://github.com/Financial-Times/cp-content-pipeline/commit/fa44f99526b4903cc78e0ca0666e99e63f3239b3))
|
|
105
|
+
* get imageset working with latest image changes ([e1eceb0](https://github.com/Financial-Times/cp-content-pipeline/commit/e1eceb0a5b8018d91aadd1699240425a29505e58))
|
|
106
|
+
* loosen image format restrictions to handle edge cases ([27ada9b](https://github.com/Financial-Times/cp-content-pipeline/commit/27ada9b62405c9036e484e041337a3f590faa2f8))
|
|
107
|
+
* missing credit on images ([62a10d3](https://github.com/Financial-Times/cp-content-pipeline/commit/62a10d3146d1af49371262e247b6c0cb2140d432))
|
|
108
|
+
* output o-editorial-typography heading classes (is this right?) ([e160876](https://github.com/Financial-Times/cp-content-pipeline/commit/e1608769866555a79f1caaaf84e7c8d4c2c252d7))
|
|
109
|
+
* output o-editorial-typography heading classes (is this right?) ([38e3d86](https://github.com/Financial-Times/cp-content-pipeline/commit/38e3d86345768eecd1203c2844e94a457aa661b2))
|
|
110
|
+
* reinstate twitter error handling ([6ba321c](https://github.com/Financial-Times/cp-content-pipeline/commit/6ba321cf6a3d66f58cd1c0f3df40eaf9b8076054))
|
|
111
|
+
* remove trailing index ([b7566fb](https://github.com/Financial-Times/cp-content-pipeline/commit/b7566fb0144d779d3164767e089a61706322ddc4))
|
|
112
|
+
* rename PullQuote to Pullquote to align with Blockquote ([e160876](https://github.com/Financial-Times/cp-content-pipeline/commit/e1608769866555a79f1caaaf84e7c8d4c2c252d7))
|
|
113
|
+
* rename PullQuote to Pullquote to align with Blockquote ([e192df6](https://github.com/Financial-Times/cp-content-pipeline/commit/e192df6ea4896aef6ab9ecbd76cf98f27add0caf))
|
|
114
|
+
* rename subhead to subheading ([e160876](https://github.com/Financial-Times/cp-content-pipeline/commit/e1608769866555a79f1caaaf84e7c8d4c2c252d7))
|
|
115
|
+
* rename subhead to subheading ([e89e34a](https://github.com/Financial-Times/cp-content-pipeline/commit/e89e34afd61192f6f6f93ee27cb60d28539b8f98))
|
|
116
|
+
* render byline links as a custom author-link node ([9a4dfc0](https://github.com/Financial-Times/cp-content-pipeline/commit/9a4dfc02810744054d0137f8cb4e640d9cd8e7f5))
|
|
117
|
+
* render tweet html using dangerouslyRender ([a0aa543](https://github.com/Financial-Times/cp-content-pipeline/commit/a0aa54387dd02bed77fde025f006796f444523a6))
|
|
118
|
+
* style headings usign n-content-body styles ([f1d8b0f](https://github.com/Financial-Times/cp-content-pipeline/commit/f1d8b0f65225295d6324ce65ab2ca2b962c7a0ff))
|
|
119
|
+
* uncomment out exported UI components from index ([c60ab7d](https://github.com/Financial-Times/cp-content-pipeline/commit/c60ab7d32d23d145a8f15d9ccb8e35b4e44f9c7c))
|
|
120
|
+
* update layout-width to match new names ([b6f5327](https://github.com/Financial-Times/cp-content-pipeline/commit/b6f5327422521437ae18f88f6100e1fcfa1f8cb4))
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
### Code Refactoring
|
|
124
|
+
|
|
125
|
+
* update references to use External type ([6ba321c](https://github.com/Financial-Times/cp-content-pipeline/commit/6ba321cf6a3d66f58cd1c0f3df40eaf9b8076054))
|
|
126
|
+
* update to latest content-tree ImageSet changes ([6d33d38](https://github.com/Financial-Times/cp-content-pipeline/commit/6d33d383586841e83e08685ce93ca87964825297))
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
### Dependencies
|
|
130
|
+
|
|
131
|
+
* The following workspace dependencies were updated
|
|
132
|
+
* devDependencies
|
|
133
|
+
* @financial-times/cp-content-pipeline-client bumped from ^0.4.0 to ^0.5.0
|
|
134
|
+
|
|
69
135
|
## [0.4.0](https://github.com/Financial-Times/cp-content-pipeline/compare/cp-content-pipeline-ui-v0.3.15...cp-content-pipeline-ui-v0.4.0) (2022-12-14)
|
|
70
136
|
|
|
71
137
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Content Pipeline UI Components
|
|
2
2
|
|
|
3
|
-
Provides a set of React components that can be used to render content received from the GraphQL API.
|
|
3
|
+
Provides a set of React components that can be used to render content received from the GraphQL API, including [Content Tree](https://github.com/Financial-Times/content-tree) components.
|
|
4
4
|
|
|
5
5
|
The components can be used independently or alongside the [GraphQL Client](../client/README.md) which supplies content data from CAPI and other sources.
|
|
6
6
|
|
|
@@ -48,51 +48,59 @@ Each Component in this package contains a function which returns a JSX object. C
|
|
|
48
48
|
|
|
49
49
|
## Rendering
|
|
50
50
|
|
|
51
|
-
We use `<RichText>` to render our JSX components. It takes a structured data object and an optional list of component overrides and renders JSX components for each `tag` in that dataset. The supported Body tags are defined in a [componentMap](./src/components/RichText/index.tsx#42) and they refer to the set of Components which can be rendered.
|
|
51
|
+
We use `<RichText>` to render our JSX components. It takes a structured data object matching the [content-tree spec](https://github.com/Financial-Times/content-tree), and an optional list of component overrides and renders JSX components for each `tag` in that dataset. The supported Body tags are defined in a [componentMap](./src/components/RichText/index.tsx#42) and they refer to the set of Components which can be rendered.
|
|
52
52
|
|
|
53
53
|
Any component override must be a valid [JSX functional or class constructor](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/24f1d0c82da2d898acd03fbb3e692eba3c431f82/types/react/index.d.ts#L80).
|
|
54
54
|
|
|
55
|
-
- ✅ `{
|
|
56
|
-
- ✅ `{
|
|
57
|
-
- ✅ `{
|
|
58
|
-
- ❌ `{
|
|
55
|
+
- ✅ `{ paragraph: (props) => (<p>{props.children}</p>) }`
|
|
56
|
+
- ✅ `{ paragraph: MyParagraphComponent }`
|
|
57
|
+
- ✅ `{ paragraph: () => null }`
|
|
58
|
+
- ❌ `{ paragraph: 'p' }`
|
|
59
59
|
|
|
60
60
|
The `Fallback` component is a special instance. This component is used whenever the renderer encounters a tag that it doesn't have a component mapping for. The default behaviour is to render any known child components. This `Fallback` component can also be overridden in the same way others can.
|
|
61
61
|
|
|
62
|
-
Our [Schema](../schema/README.md) package uses
|
|
62
|
+
Our [Schema](../schema/README.md) package uses converts a `bodyXML` from the content API, into structured `content-tree` [Body node](https://github.com/Financial-Times/content-tree#body) which is renderable by `<RichText>`. That process generates a `tree`, and a set of `references` for any external content required to render.
|
|
63
63
|
|
|
64
64
|
### Example usage
|
|
65
65
|
|
|
66
66
|
```jsx
|
|
67
67
|
const structuredContent = {
|
|
68
|
-
tree:
|
|
68
|
+
tree: contentTree,
|
|
69
69
|
references: [{
|
|
70
|
-
|
|
70
|
+
type: 'recommended',
|
|
71
71
|
teaser: {}
|
|
72
72
|
}] // Array of additional props to pass to components
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
const components = {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
paragraph: ParagraphComponent,
|
|
77
|
+
link: LinkComponent,
|
|
78
|
+
'image-set': ImageSetComponent
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
<RichText structuredContent={structuredContent} components={components} />
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
-
### What is a
|
|
84
|
+
### What is a Content Tree?
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
[Content Tree] is a format for representing Financial Times article content as a JSON tree (following the [unist](https://github.com/syntax-tree/unist) spec).
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
It is a shared contract between [Spark](https://biz-ops.in.ft.com/Team/digitalnewsroomsupport) and [Customer Products](https://biz-ops.in.ft.com/Group/customerproducts) defining what the content should look like, so that it can be used to both preview and render an article.
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
### What is a node?
|
|
91
|
+
|
|
92
|
+
Each node in the content tree has a `type` property, which corresponds to a Component which can be rendered, e.g. `paragraph`, `link`, `image-set`.
|
|
93
|
+
|
|
94
|
+
The spec for these nodes determines what data is available to those components.
|
|
91
95
|
|
|
92
96
|
### What are references?
|
|
93
97
|
|
|
94
|
-
|
|
98
|
+
Some nodes in the tree require additional data that isn't available from the CMS (for example, a tweet requires the embed code from the Twitter API).
|
|
99
|
+
|
|
100
|
+
The shape of this additional data is defined in the content tree for that node as optional properties, to indicate that it may not be present in the generated tree.
|
|
101
|
+
|
|
102
|
+
To provide this external data to the content tree, we produce an array of "references", which are objects containing additional fields.
|
|
95
103
|
|
|
96
|
-
|
|
104
|
+
When generating the content tree in the API, an additional property `node.data.referenceIndex` is added to any node which has a reference in this array.
|
|
97
105
|
|
|
98
|
-
|
|
106
|
+
The `<RichText>` component will automatically pass the additional props from the `references` to the corresponding JSX component for that node when it is being rendered.
|
|
@@ -6,8 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
7
|
const RichText_1 = __importDefault(require("../RichText"));
|
|
8
8
|
function ArticleBody({ content, components }) {
|
|
9
|
-
|
|
10
|
-
if (!((_a = content === null || content === void 0 ? void 0 : content.body) === null || _a === void 0 ? void 0 : _a.structured)) {
|
|
9
|
+
if (!content?.body?.structured) {
|
|
11
10
|
return null;
|
|
12
11
|
}
|
|
13
12
|
return (react_1.default.createElement("article", { className: "n-content-body" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ArticleBody/index.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AACzB,2DAAkC;AAGlC,SAAwB,WAAW,CAAC,EAAE,OAAO,EAAE,UAAU,EAAa
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ArticleBody/index.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AACzB,2DAAkC;AAGlC,SAAwB,WAAW,CAAC,EAAE,OAAO,EAAE,UAAU,EAAa;IACpE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE;QAC9B,OAAO,IAAI,CAAA;KACZ;IAED,OAAO,CACL,2CAAS,SAAS,EAAC,gBAAgB;QACjC,8BAAC,kBAAQ,IACP,iBAAiB,EAAE,OAAO,CAAC,IAAI,CAAC,UAAU,EAC1C,UAAU,EAAE,UAAU,GACtB,CACM,CACX,CAAA;AACH,CAAC;AAbD,8BAaC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
2
|
import type { ArticleQuery } from '@financial-times/cp-content-pipeline-client';
|
|
3
3
|
declare type ArticleInfoProps = {
|
|
4
4
|
content: ArticleQuery['content'];
|
|
5
5
|
};
|
|
6
|
-
export default function ArticleInfo({ content }: ArticleInfoProps): JSX.Element;
|
|
6
|
+
export default function ArticleInfo({ children, content }: PropsWithChildren<ArticleInfoProps>): JSX.Element;
|
|
7
7
|
export {};
|
|
@@ -5,12 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
7
|
const Byline_1 = __importDefault(require("../Byline"));
|
|
8
|
-
function ArticleInfo({ content }) {
|
|
8
|
+
function ArticleInfo({ children, content }) {
|
|
9
9
|
return (react_1.default.createElement("div", { className: "article-info" },
|
|
10
10
|
react_1.default.createElement("div", { className: "article-info__time-byline" },
|
|
11
11
|
content.byline && react_1.default.createElement(Byline_1.default, { structuredContent: content.byline }),
|
|
12
12
|
react_1.default.createElement("span", null, " "),
|
|
13
|
-
content.publishedDate && (react_1.default.createElement("time", { "data-o-component": "o-date", className: "article-info__timestamp o-date", dateTime: content.publishedDate })))
|
|
13
|
+
content.publishedDate && (react_1.default.createElement("time", { "data-o-component": "o-date", className: "article-info__timestamp o-date", dateTime: content.publishedDate }))),
|
|
14
|
+
children));
|
|
14
15
|
}
|
|
15
16
|
exports.default = ArticleInfo;
|
|
16
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ArticleInfo/index.tsx"],"names":[],"mappings":";;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ArticleInfo/index.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAgD;AAChD,uDAA8B;AAO9B,SAAwB,WAAW,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAuC;IAE5F,OAAO,CACL,uCAAK,SAAS,EAAC,cAAc;QAC3B,uCAAK,SAAS,EAAC,2BAA2B;YACvC,OAAO,CAAC,MAAM,IAAI,8BAAC,gBAAM,IAAC,iBAAiB,EAAE,OAAO,CAAC,MAAM,GAAI;YAChE,gDAAc;YACb,OAAO,CAAC,aAAa,IAAI,CACxB,4DACmB,QAAQ,EACzB,SAAS,EAAC,gCAAgC,EAC1C,QAAQ,EAAE,OAAO,CAAC,aAAa,GAC/B,CACH,CACG;QACL,QAAQ,CACL,CACP,CAAA;AACH,CAAC;AAlBD,8BAkBC"}
|
|
@@ -7,14 +7,15 @@ const react_1 = __importDefault(require("react"));
|
|
|
7
7
|
const index_js_1 = __importDefault(require("../ArticleBody/index.js"));
|
|
8
8
|
const index_js_2 = __importDefault(require("../LiveBlogBody/index.js"));
|
|
9
9
|
function Body({ content, components }) {
|
|
10
|
-
|
|
11
|
-
if (!((_a = content === null || content === void 0 ? void 0 : content.body) === null || _a === void 0 ? void 0 : _a.structured)) {
|
|
10
|
+
if (!content?.body?.structured) {
|
|
12
11
|
return null;
|
|
13
12
|
}
|
|
13
|
+
const LiveBlog = components?.['live-blog-body'] ?? index_js_2.default;
|
|
14
|
+
const Article = components?.['article-body'] ?? index_js_1.default;
|
|
14
15
|
if (content.__typename === 'LiveBlogPackage') {
|
|
15
|
-
return react_1.default.createElement(
|
|
16
|
+
return react_1.default.createElement(LiveBlog, { content: content, components: components });
|
|
16
17
|
}
|
|
17
|
-
return react_1.default.createElement(
|
|
18
|
+
return react_1.default.createElement(Article, { content: content, components: components });
|
|
18
19
|
}
|
|
19
20
|
exports.default = Body;
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Body/index.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AACzB,uEAAiD;AACjD,wEAAmD;AASnD,SAAwB,IAAI,CAAC,EAAE,OAAO,EAAE,UAAU,EAAa
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Body/index.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AACzB,uEAAiD;AACjD,wEAAmD;AASnD,SAAwB,IAAI,CAAC,EAAE,OAAO,EAAE,UAAU,EAAa;IAC7D,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE;QAC9B,OAAO,IAAI,CAAA;KACZ;IAED,MAAM,QAAQ,GAAG,UAAU,EAAE,CAAC,gBAAgB,CAAC,IAAI,kBAAY,CAAA;IAC/D,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC,cAAc,CAAC,IAAI,kBAAW,CAAA;IAE3D,IAAI,OAAO,CAAC,UAAU,KAAK,iBAAiB,EAAE;QAC5C,OAAO,8BAAC,QAAQ,IAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,GAAI,CAAA;KAC9D;IAED,OAAO,8BAAC,OAAO,IAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,GAAI,CAAA;AAC9D,CAAC;AAbD,uBAaC"}
|
|
@@ -5,9 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
7
|
const index_js_1 = __importDefault(require("../RichText/index.js"));
|
|
8
|
+
const AuthorLink = (props) => (react_1.default.createElement("a", { className: "n-content-tag--author", href: props.href }, props.children));
|
|
9
|
+
const bylineComponents = {
|
|
10
|
+
'author-link': AuthorLink,
|
|
11
|
+
};
|
|
8
12
|
function Byline({ structuredContent }) {
|
|
9
13
|
return (react_1.default.createElement("p", { className: "article-info__byline" },
|
|
10
|
-
react_1.default.createElement(index_js_1.default, { structuredContent: structuredContent })));
|
|
14
|
+
react_1.default.createElement(index_js_1.default, { structuredContent: structuredContent, components: bylineComponents })));
|
|
11
15
|
}
|
|
12
16
|
exports.default = Byline;
|
|
13
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Byline/index.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AAGzB,oEAA2C;AAM3C,SAAwB,MAAM,CAAC,EAAE,iBAAiB,EAAe;IAC/D,OAAO,CACL,qCAAG,SAAS,EAAC,sBAAsB;QACjC,8BAAC,kBAAQ,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Byline/index.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AAGzB,oEAA2C;AAM3C,MAAM,UAAU,GAAG,CAAC,KAAU,EAAE,EAAE,CAAC,CACjC,qCAAG,SAAS,EAAC,uBAAuB,EAAC,IAAI,EAAE,KAAK,CAAC,IAAI,IAClD,KAAK,CAAC,QAAQ,CACb,CACL,CAAA;AAED,MAAM,gBAAgB,GAAG;IACvB,aAAa,EAAE,UAAU;CAC1B,CAAA;AAED,SAAwB,MAAM,CAAC,EAAE,iBAAiB,EAAe;IAC/D,OAAO,CACL,qCAAG,SAAS,EAAC,sBAAsB;QACjC,8BAAC,kBAAQ,IACP,iBAAiB,EAAE,iBAAiB,EACpC,UAAU,EAAE,gBAAgB,GAC5B,CACA,CACL,CAAA;AACH,CAAC;AATD,yBASC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { ContentTree } from '@financial-times/content-tree';
|
|
2
3
|
import { FlourishFragment } from '@financial-times/cp-content-pipeline-client';
|
|
3
|
-
export default function Flourish({ id,
|
|
4
|
+
export default function Flourish({ id, flourishType, description, layoutWidth, fallbackImage, }: ContentTree.Flourish & FlourishFragment): JSX.Element;
|
|
@@ -9,19 +9,20 @@ const DisclaimerNotice = ({ id }) => (react_1.default.createElement("div", { id:
|
|
|
9
9
|
react_1.default.createElement("div", { className: "o-message__container" },
|
|
10
10
|
react_1.default.createElement("div", { className: "o-message__content" },
|
|
11
11
|
react_1.default.createElement("p", { className: "o-message__content-main" }, "You are seeing a snapshot of an interactive graphic. This is most likely due to being offline or JavaScript being disabled in your browser.")))));
|
|
12
|
-
function Flourish({ id,
|
|
12
|
+
function Flourish({ id, flourishType, description, layoutWidth, fallbackImage, }) {
|
|
13
13
|
const anchorHref = `#${id}`;
|
|
14
|
+
const fullGrid = layoutWidth === 'grid';
|
|
14
15
|
const figureClassnames = (0, classnames_1.default)({
|
|
15
16
|
'n-content-picture': true,
|
|
16
17
|
'n-content-layout__container': true,
|
|
17
18
|
'n-content-picture--wide': fullGrid,
|
|
18
19
|
});
|
|
19
20
|
return (react_1.default.createElement("div", { className: "n-content-layout", "data-layout-width": fullGrid ? 'full-grid' : null },
|
|
20
|
-
react_1.default.createElement("figure", { className: figureClassnames, "data-original-image-width": fullGrid ? fallbackImage
|
|
21
|
+
react_1.default.createElement("figure", { className: figureClassnames, "data-original-image-width": fullGrid ? fallbackImage?.width : null, "data-original-image-height": fullGrid ? fallbackImage?.height : null },
|
|
21
22
|
react_1.default.createElement("a", { href: anchorHref },
|
|
22
|
-
react_1.default.createElement("picture", { "data-asset-type": "flourish", "data-flourish-id": id, "data-flourish-type":
|
|
23
|
+
react_1.default.createElement("picture", { "data-asset-type": "flourish", "data-flourish-id": id, "data-flourish-type": flourishType },
|
|
23
24
|
react_1.default.createElement(DisclaimerNotice, { id: id }),
|
|
24
|
-
react_1.default.createElement("img", { src: fallbackImage
|
|
25
|
+
react_1.default.createElement("img", { src: fallbackImage?.url, alt: description }))))));
|
|
25
26
|
}
|
|
26
27
|
exports.default = Flourish;
|
|
27
28
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Flourish/index.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AACzB,4DAAmC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRo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,2BAsCC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
exports.default = (props) => {
|
|
8
|
+
switch (props.level) {
|
|
9
|
+
case 'chapter':
|
|
10
|
+
return react_1.default.createElement("h2", { className: "n-content-heading-2" }, props.children);
|
|
11
|
+
case 'subheading':
|
|
12
|
+
return react_1.default.createElement("h3", { className: "n-content-heading-3" }, props.children);
|
|
13
|
+
case 'label':
|
|
14
|
+
return react_1.default.createElement("h5", { className: "n-content-heading-5" }, props.children);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Heading/index.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AAIzB,kBAAe,CAAC,KAAsD,EAAE,EAAE;IACxE,QAAQ,KAAK,CAAC,KAAK,EAAE;QACnB,KAAK,SAAS;YACZ,OAAO,sCAAI,SAAS,EAAC,qBAAqB,IAAE,KAAK,CAAC,QAAQ,CAAM,CAAA;QAClE,KAAK,YAAY;YACf,OAAO,sCAAI,SAAS,EAAC,qBAAqB,IAAE,KAAK,CAAC,QAAQ,CAAM,CAAA;QAClE,KAAK,OAAO;YACV,OAAO,sCAAI,SAAS,EAAC,qBAAqB,IAAE,KAAK,CAAC,QAAQ,CAAM,CAAA;KACnE;AACH,CAAC,CAAA"}
|
|
@@ -1,3 +1,21 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { ImageSetFragment } from '@financial-times/cp-content-pipeline-client';
|
|
3
|
-
|
|
2
|
+
import type { ImageFragment, ImageSetFragment } from '@financial-times/cp-content-pipeline-client';
|
|
3
|
+
import type { ContentTree } from '@financial-times/content-tree';
|
|
4
|
+
declare type ImageType = ContentTree.Image | ImageFragment;
|
|
5
|
+
declare type Breakpoint = {
|
|
6
|
+
minWidth?: number;
|
|
7
|
+
maxWidth?: number;
|
|
8
|
+
};
|
|
9
|
+
declare const defaultGetBreakpoints: (image: ImageType) => Breakpoint | undefined;
|
|
10
|
+
export declare type BreakpointGetter = typeof defaultGetBreakpoints;
|
|
11
|
+
declare type SourcesProps = {
|
|
12
|
+
images: readonly ImageType[];
|
|
13
|
+
getBreakpoints?: BreakpointGetter;
|
|
14
|
+
};
|
|
15
|
+
export declare function Sources({ images, getBreakpoints }: SourcesProps): JSX.Element;
|
|
16
|
+
export declare function FallbackImage({ image, imageType, }: {
|
|
17
|
+
image: ContentTree.Image;
|
|
18
|
+
imageType: string;
|
|
19
|
+
}): JSX.Element;
|
|
20
|
+
export default function ImageSet(imageSet: ImageSetFragment & ContentTree.ImageSet): JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -3,62 +3,64 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FallbackImage = exports.Sources = void 0;
|
|
6
7
|
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const
|
|
8
|
+
const formatSourceSet = (image) => image.sourceSet.map((src) => `${src.url} ${src.dpr}x`).join(',');
|
|
8
9
|
const figureClassNameMap = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
'full-grid': 'n-content-picture n-content-picture--wide n-content-layout__container',
|
|
11
|
+
'inset-left': 'n-content-image n-content-image--inline',
|
|
12
|
+
standard: 'n-content-image n-content-image--full',
|
|
12
13
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
const defaultGetBreakpoints = (image) => {
|
|
15
|
+
switch (image.format) {
|
|
16
|
+
case 'mobile':
|
|
17
|
+
return { maxWidth: 490 };
|
|
18
|
+
case 'desktop':
|
|
19
|
+
return { minWidth: 980 };
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const breakpointToMedia = (breakpoint) => [
|
|
23
|
+
breakpoint.minWidth && `(min-width: ${breakpoint.minWidth})`,
|
|
24
|
+
breakpoint.maxWidth && `(max-width: ${breakpoint.maxWidth})`,
|
|
25
|
+
]
|
|
26
|
+
.filter(Boolean)
|
|
27
|
+
.join(' and ');
|
|
28
|
+
function hasSourceSet(image) {
|
|
29
|
+
return image && 'sourceSet' in image;
|
|
24
30
|
}
|
|
25
|
-
function
|
|
26
|
-
|
|
27
|
-
src: image.sources[0].url,
|
|
28
|
-
alt,
|
|
29
|
-
srcSet: image.sources.length > 1 ? srcSet(image) : undefined,
|
|
30
|
-
'data-image-type': type.toLowerCase(),
|
|
31
|
-
width: image.originalWidth,
|
|
32
|
-
height: image.originalHeight,
|
|
33
|
-
};
|
|
34
|
-
return react_1.default.createElement("img", { ...props });
|
|
31
|
+
function hasAlt(image) {
|
|
32
|
+
return image && 'alt' in image;
|
|
35
33
|
}
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
throw new Error(`ImageSet of type ${picture.__typename} has no images. Check that they are present in the query`);
|
|
41
|
-
}
|
|
42
|
-
if (!picture.images.standard ||
|
|
43
|
-
'minDisplayWidth' in picture.images.standard ||
|
|
44
|
-
'maxDisplayWidth' in picture.images.standard) {
|
|
45
|
-
throw new Error(`ImageSet must include a "standard" image, without any breakpoint restrictions.`);
|
|
34
|
+
function Source({ image, getBreakpoints = defaultGetBreakpoints, }) {
|
|
35
|
+
const breakpoints = getBreakpoints(image);
|
|
36
|
+
if (!hasSourceSet(image) || !breakpoints) {
|
|
37
|
+
return null;
|
|
46
38
|
}
|
|
47
|
-
|
|
48
|
-
return (react_1.default.createElement("figure", { className: figureClassNameMap[picture.__typename] || 'n-content-image' },
|
|
49
|
-
react_1.default.createElement("picture", null,
|
|
50
|
-
pictureImages.map((image, index) => (react_1.default.createElement(Source, { key: index, image: image }))),
|
|
51
|
-
react_1.default.createElement(Image, { image: picture.images.standard, alt: picture.alt, type: picture.imageType })),
|
|
52
|
-
picture.caption && (react_1.default.createElement("figcaption", { className: "n-content-picture__caption" }, picture.caption))));
|
|
39
|
+
return (react_1.default.createElement("source", { media: breakpointToMedia(breakpoints), srcSet: formatSourceSet(image), width: image.width, height: image.height }));
|
|
53
40
|
}
|
|
54
|
-
function
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
41
|
+
function Sources({ images, getBreakpoints }) {
|
|
42
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, images.map((image, index) => (react_1.default.createElement(Source, { key: index, image: image, getBreakpoints: getBreakpoints })))));
|
|
43
|
+
}
|
|
44
|
+
exports.Sources = Sources;
|
|
45
|
+
// TODO should `fallback` be added to content-tree imageset?
|
|
46
|
+
function FallbackImage({ image, imageType = 'image', }) {
|
|
47
|
+
return (react_1.default.createElement("img", { src: hasSourceSet(image) ? image.sourceSet[0].url : image.url, srcSet: hasSourceSet(image) ? formatSourceSet(image) : undefined, alt: hasAlt(image) ? image.alt : '', "data-image-type": imageType, width: image.width, height: image.height }));
|
|
48
|
+
}
|
|
49
|
+
exports.FallbackImage = FallbackImage;
|
|
50
|
+
function ImageSet(imageSet) {
|
|
51
|
+
if (!imageSet.picture.images) {
|
|
52
|
+
throw new Error(`ImageSet of type ${imageSet.picture?.layoutWidth} has no images. Check that they are present in the query`);
|
|
61
53
|
}
|
|
54
|
+
return (react_1.default.createElement("div", { className: imageSet.picture.layoutWidth === 'full-grid' ? 'n-content-layout' : '', "data-layout-width": imageSet.picture.layoutWidth },
|
|
55
|
+
react_1.default.createElement("figure", { className: figureClassNameMap[imageSet.picture.layoutWidth] || 'n-content-image' },
|
|
56
|
+
react_1.default.createElement("picture", null,
|
|
57
|
+
react_1.default.createElement(Sources, { images: imageSet.picture.images }),
|
|
58
|
+
react_1.default.createElement(FallbackImage, { image: imageSet.picture.fallbackImage, imageType: imageSet.picture.imageType || 'image' })),
|
|
59
|
+
(imageSet.picture.caption || imageSet.picture.credit) && (react_1.default.createElement("figcaption", { className: "n-content-picture__caption" },
|
|
60
|
+
react_1.default.createElement("span", null, imageSet.picture.caption),
|
|
61
|
+
react_1.default.createElement("span", null,
|
|
62
|
+
imageSet.picture.caption ? ' ' : '',
|
|
63
|
+
imageSet.picture.credit))))));
|
|
62
64
|
}
|
|
63
65
|
exports.default = ImageSet;
|
|
64
66
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ImageSet/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ImageSet/index.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AAkBzB,MAAM,eAAe,GAAG,CAAC,KAAyB,EAAE,EAAE,CACpD,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAElE,MAAM,kBAAkB,GAGpB;IACF,WAAW,EACT,uEAAuE;IACzE,YAAY,EAAE,yCAAyC;IACvD,QAAQ,EAAE,uCAAuC;CAClD,CAAA;AAOD,MAAM,qBAAqB,GAAG,CAAC,KAAgB,EAA0B,EAAE;IACzE,QAAQ,KAAK,CAAC,MAAM,EAAE;QACpB,KAAK,QAAQ;YACX,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAA;QAC1B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,SAAS,IAAI,OAAO,GAChD,CACM;YACT,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,IAAI,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CACxD,8CAAY,SAAS,EAAC,4BAA4B;gBAChD,4CAAO,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAQ;gBACvC;oBACG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;oBACnC,QAAQ,CAAC,OAAO,CAAC,MAAM,CACnB,CACI,CACd,CACM,CACL,CACP,CAAA;AACH,CAAC;AAxCD,2BAwCC"}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
children: ReactNode;
|
|
4
|
-
dataLayoutName: string;
|
|
5
|
-
dataLayoutWidth: 'full-grid' | 'fullWidth';
|
|
6
|
-
};
|
|
1
|
+
import { ContentTree } from '@financial-times/content-tree';
|
|
2
|
+
import React, { ReactNode } from 'react';
|
|
7
3
|
declare type LayoutContainerProps = {
|
|
8
4
|
children: ReactNode;
|
|
9
5
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
6
|
+
interface ContentTreeLayoutSlot extends ContentTree.Node {
|
|
7
|
+
type: 'slot';
|
|
8
|
+
children: [ContentTree.ImageSet?, ...ContentTree.Paragraph[]];
|
|
9
|
+
}
|
|
10
|
+
interface ContentTreeCardLayout extends ContentTree.Node {
|
|
11
|
+
type: 'layout';
|
|
12
|
+
layoutName: 'auto' | 'card' | 'timeline';
|
|
13
|
+
layoutWidth: 'inset-left' | 'full-width' | 'full-grid';
|
|
14
|
+
children: ContentTreeLayoutSlot[];
|
|
15
|
+
}
|
|
16
|
+
export declare function Layout({ children, layoutWidth, layoutName, }: React.PropsWithChildren<ContentTreeCardLayout>): JSX.Element;
|
|
15
17
|
export declare function LayoutContainer({ children }: LayoutContainerProps): JSX.Element;
|
|
16
|
-
export declare function LayoutSlot({ children
|
|
18
|
+
export declare function LayoutSlot({ children }: React.PropsWithChildren): JSX.Element;
|
|
17
19
|
export {};
|
|
@@ -5,16 +5,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.LayoutSlot = exports.LayoutContainer = exports.Layout = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
|
-
function Layout({ children,
|
|
9
|
-
return (react_1.default.createElement("div", { className: "n-content-layout", "data-layout-name":
|
|
8
|
+
function Layout({ children, layoutWidth, layoutName, }) {
|
|
9
|
+
return (react_1.default.createElement("div", { className: "n-content-layout", "data-layout-name": layoutName, "data-layout-width": layoutWidth },
|
|
10
|
+
react_1.default.createElement(LayoutContainer, null, children)));
|
|
10
11
|
}
|
|
11
12
|
exports.Layout = Layout;
|
|
12
13
|
function LayoutContainer({ children }) {
|
|
13
14
|
return react_1.default.createElement("div", { className: "n-content-layout__container" }, children);
|
|
14
15
|
}
|
|
15
16
|
exports.LayoutContainer = LayoutContainer;
|
|
16
|
-
function LayoutSlot({ children
|
|
17
|
-
return
|
|
17
|
+
function LayoutSlot({ children }) {
|
|
18
|
+
return react_1.default.createElement("div", { className: "n-content-layout__slot" }, children);
|
|
18
19
|
}
|
|
19
20
|
exports.LayoutSlot = LayoutSlot;
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Layout/index.tsx"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Layout/index.tsx"],"names":[],"mappings":";;;;;;AACA,kDAAwC;AAkBxC,SAAgB,MAAM,CAAC,EACrB,QAAQ,EACR,WAAW,EACX,UAAU,GACqC;IAC/C,OAAO,CACL,uCACE,SAAS,EAAC,kBAAkB,sBACV,UAAU,uBACT,WAAW;QAE9B,8BAAC,eAAe,QAAE,QAAQ,CAAmB,CACzC,CACP,CAAA;AACH,CAAC;AAdD,wBAcC;AAED,SAAgB,eAAe,CAAC,EAAE,QAAQ,EAAwB;IAChE,OAAO,uCAAK,SAAS,EAAC,6BAA6B,IAAE,QAAQ,CAAO,CAAA;AACtE,CAAC;AAFD,0CAEC;AAED,SAAgB,UAAU,CAAC,EAAE,QAAQ,EAA2B;IAC9D,OAAO,uCAAK,SAAS,EAAC,wBAAwB,IAAE,QAAQ,CAAO,CAAA;AACjE,CAAC;AAFD,gCAEC"}
|
|
@@ -4,15 +4,12 @@ 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 x_interaction_1 = require("@financial-times/x-interaction");
|
|
8
7
|
const x_live_blog_wrapper_1 = require("@financial-times/x-live-blog-wrapper");
|
|
8
|
+
const index_js_1 = __importDefault(require("../RichText/index.js"));
|
|
9
9
|
function LiveBlogBody({ content }) {
|
|
10
10
|
if (content.__typename !== 'LiveBlogPackage')
|
|
11
11
|
return null;
|
|
12
|
-
|
|
13
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
14
|
-
react_1.default.createElement(x_live_blog_wrapper_1.LiveBlogWrapper, { posts: content.liveBlogPosts, articleUrl: `https://www.ft.com/content/${content.id}`, showShareButtons: true, id: "live-blog-wrapper", serialiser: serialiser }),
|
|
15
|
-
react_1.default.createElement(x_interaction_1.HydrationData, { serialiser: serialiser })));
|
|
12
|
+
return (react_1.default.createElement(x_live_blog_wrapper_1.LiveBlogWrapper, { posts: content.liveBlogPosts, articleUrl: `https://www.ft.com/content/${content.id}`, showShareButtons: true, id: "live-blog-wrapper", renderRichText: index_js_1.default }));
|
|
16
13
|
}
|
|
17
14
|
exports.default = LiveBlogBody;
|
|
18
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/LiveBlogBody/index.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AACzB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/LiveBlogBody/index.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AACzB,8EAAsE;AAGtE,oEAA2C;AAE3C,SAAwB,YAAY,CAAC,EAAE,OAAO,EAAa;IACzD,IAAI,OAAO,CAAC,UAAU,KAAK,iBAAiB;QAAE,OAAO,IAAI,CAAA;IACzD,OAAO,CACL,8BAAC,qCAAe,IACd,KAAK,EAAE,OAAO,CAAC,aAAa,EAC5B,UAAU,EAAE,8BAA8B,OAAO,CAAC,EAAE,EAAE,EACtD,gBAAgB,EAAE,IAAI,EACtB,EAAE,EAAC,mBAAmB,EACtB,cAAc,EAAE,kBAAQ,GACxB,CACH,CAAA;AACH,CAAC;AAXD,+BAWC"}
|