@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.
Files changed (88) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/README.md +27 -19
  3. package/lib/components/ArticleBody/index.js +1 -2
  4. package/lib/components/ArticleBody/index.js.map +1 -1
  5. package/lib/components/ArticleInfo/index.d.ts +2 -2
  6. package/lib/components/ArticleInfo/index.js +3 -2
  7. package/lib/components/ArticleInfo/index.js.map +1 -1
  8. package/lib/components/Body/index.js +5 -4
  9. package/lib/components/Body/index.js.map +1 -1
  10. package/lib/components/Byline/index.js +5 -1
  11. package/lib/components/Byline/index.js.map +1 -1
  12. package/lib/components/Flourish/index.d.ts +2 -1
  13. package/lib/components/Flourish/index.js +5 -4
  14. package/lib/components/Flourish/index.js.map +1 -1
  15. package/lib/components/Heading/index.d.ts +6 -0
  16. package/lib/components/Heading/index.js +17 -0
  17. package/lib/components/Heading/index.js.map +1 -0
  18. package/lib/components/ImageSet/index.d.ts +20 -2
  19. package/lib/components/ImageSet/index.js +50 -48
  20. package/lib/components/ImageSet/index.js.map +1 -1
  21. package/lib/components/Layout/index.d.ts +14 -12
  22. package/lib/components/Layout/index.js +5 -4
  23. package/lib/components/Layout/index.js.map +1 -1
  24. package/lib/components/LiveBlogBody/index.js +2 -5
  25. package/lib/components/LiveBlogBody/index.js.map +1 -1
  26. package/lib/components/MainImage/index.js +2 -3
  27. package/lib/components/MainImage/index.js.map +1 -1
  28. package/lib/components/Pullquote/index.d.ts +4 -0
  29. package/lib/components/Pullquote/index.js +10 -0
  30. package/lib/components/Pullquote/index.js.map +1 -0
  31. package/lib/components/Recommended/index.d.ts +2 -2
  32. package/lib/components/Recommended/index.js +2 -4
  33. package/lib/components/Recommended/index.js.map +1 -1
  34. package/lib/components/RichText/BasicComponents.d.ts +10 -12
  35. package/lib/components/RichText/BasicComponents.js +6 -12
  36. package/lib/components/RichText/BasicComponents.js.map +1 -1
  37. package/lib/components/RichText/index.d.ts +3 -3
  38. package/lib/components/RichText/index.js +48 -56
  39. package/lib/components/RichText/index.js.map +1 -1
  40. package/lib/components/RichText/index.test.js +31 -66
  41. package/lib/components/RichText/index.test.js.map +1 -1
  42. package/lib/components/Topper/Columnist.js +1 -2
  43. package/lib/components/Topper/Columnist.js.map +1 -1
  44. package/lib/components/Topper/Picture.d.ts +3 -3
  45. package/lib/components/Topper/Picture.js +26 -14
  46. package/lib/components/Topper/Picture.js.map +1 -1
  47. package/lib/components/Topper/Tags.js +1 -2
  48. package/lib/components/Topper/Tags.js.map +1 -1
  49. package/lib/components/Topper/index.js +1 -1
  50. package/lib/components/Topper/index.js.map +1 -1
  51. package/lib/components/Tweet/index.d.ts +2 -1
  52. package/lib/components/Tweet/index.js +5 -9
  53. package/lib/components/Tweet/index.js.map +1 -1
  54. package/lib/index.d.ts +4 -3
  55. package/lib/index.js +8 -9
  56. package/lib/index.js.map +1 -1
  57. package/lib/index.test.js +1 -0
  58. package/lib/index.test.js.map +1 -1
  59. package/package.json +8 -6
  60. package/src/components/ArticleInfo/index.tsx +4 -2
  61. package/src/components/Body/index.tsx +5 -2
  62. package/src/components/Byline/index.tsx +14 -1
  63. package/src/components/Flourish/index.tsx +57 -44
  64. package/src/components/Heading/index.tsx +14 -0
  65. package/src/components/ImageSet/index.tsx +126 -85
  66. package/src/components/Layout/index.tsx +18 -20
  67. package/src/components/LiveBlogBody/index.tsx +8 -13
  68. package/src/components/MainImage/index.tsx +3 -2
  69. package/src/components/Pullquote/index.tsx +12 -0
  70. package/src/components/Recommended/index.tsx +7 -12
  71. package/src/components/RichText/BasicComponents.tsx +36 -18
  72. package/src/components/RichText/index.test.tsx +48 -82
  73. package/src/components/RichText/index.tsx +60 -71
  74. package/src/components/Topper/Picture.tsx +35 -42
  75. package/src/components/Topper/index.tsx +1 -1
  76. package/src/components/Tweet/index.tsx +8 -13
  77. package/src/index.test.ts +1 -0
  78. package/src/index.ts +4 -6
  79. package/tsconfig.json +1 -0
  80. package/tsconfig.tsbuildinfo +1 -1
  81. package/lib/components/PullQuote/index.d.ts +0 -3
  82. package/lib/components/PullQuote/index.js +0 -14
  83. package/lib/components/PullQuote/index.js.map +0 -1
  84. package/lib/components/Recommended/RecommendedTitle.d.ts +0 -4
  85. package/lib/components/Recommended/RecommendedTitle.js +0 -11
  86. package/lib/components/Recommended/RecommendedTitle.js.map +0 -1
  87. package/src/components/PullQuote/index.tsx +0 -18
  88. 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
- - ✅ `{ Paragraph: (props) => (<p>{props.children}</p>) }`
56
- - ✅ `{ Paragraph: MyParagraphComponent }`
57
- - ✅ `{ Paragraph: () => null }`
58
- - ❌ `{ Paragraph: 'p' }`
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 [Unified](https://unifiedjs.com/) to transform content XML from our APIs into structured data which is renderable by `<RichText>`. That process generates a `tree` and a set of `references` for the content provided.
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: hastTree,
68
+ tree: contentTree,
69
69
  references: [{
70
- __typename: 'Recommended',
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
- Paragraph: ParagraphComponent,
77
- Link: LinkComponent,
78
- ImageSet: ImageSetComponent
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 tree?
84
+ ### What is a Content Tree?
85
85
 
86
- A `tree` is a body of content represented as a [hast](https://github.com/syntax-tree/hast) abstract syntax tree.
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
- ### What is a tag?
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
- Each node in the hast tree is given a `tagName` which corresponds to a Component which can be rendered, e.g. `Pargraph`, `Link`, `ImageSet`.
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
- A reference is an object providing additional props to a node in the tree.
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
- Nodes in the hast tree may be given a `dataReferenceId` property which corresponds to an index in the `references` array. This essentially creates a map between a node in the tree and an item in the references array. `<RichText>` will automatically pass the additional props from the `references` to the corresponding JSX component for that node when it is being rendered.
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
- Some nodes cannot be rendered without additional data which is not available in the original content tree so they rely on references to supply this context.
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
- var _a;
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;;IACpE,IAAI,CAAC,CAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,0CAAE,UAAU,CAAA,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
+ {"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
- /// <reference types="react" />
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,kDAAyB;AACzB,uDAA8B;AAO9B,SAAwB,WAAW,CAAC,EAAE,OAAO,EAAoB;IAC/D,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,CACF,CACP,CAAA;AACH,CAAC;AAhBD,8BAgBC"}
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
- var _a;
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(index_js_2.default, { content: content, components: components });
16
+ return react_1.default.createElement(LiveBlog, { content: content, components: components });
16
17
  }
17
- return react_1.default.createElement(index_js_1.default, { content: content, components: components });
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;;IAC7D,IAAI,CAAC,CAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,0CAAE,UAAU,CAAA,EAAE;QAC9B,OAAO,IAAI,CAAA;KACZ;IAED,IAAI,OAAO,CAAC,UAAU,KAAK,iBAAiB,EAAE;QAC5C,OAAO,8BAAC,kBAAY,IAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,GAAI,CAAA;KAClE;IAED,OAAO,8BAAC,kBAAW,IAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,GAAI,CAAA;AAClE,CAAC;AAVD,uBAUC"}
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,IAAC,iBAAiB,EAAE,iBAAiB,GAAI,CAChD,CACL,CAAA;AACH,CAAC;AAND,yBAMC"}
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, type, description, fullGrid, fallbackImage }: FlourishFragment): JSX.Element;
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, type, description, fullGrid, fallbackImage }) {
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 === null || fallbackImage === void 0 ? void 0 : fallbackImage.width : null, "data-original-image-height": fullGrid ? fallbackImage === null || fallbackImage === void 0 ? void 0 : fallbackImage.height : null },
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": 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 === null || fallbackImage === void 0 ? void 0 : fallbackImage.url, alt: description }))))));
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;AAOnC,MAAM,gBAAgB,GAAG,CAAC,EAAE,EAAE,EAAoB,EAAE,EAAE,CAAC,CACtD,uCAAK,EAAE,EAAE,EAAE,EAAE,SAAS,EAAC,mEAAmE,sBAAkB,WAAW;IACtH,uCAAK,SAAS,EAAC,sBAAsB;QACpC,uCAAK,SAAS,EAAC,oBAAoB;YAClC,qCAAG,SAAS,EAAC,yBAAyB,kJAElC,CACC,CACD,CACD,CACF,CACJ;AAED,SAAwB,QAAQ,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAoB;IACjG,MAAM,UAAU,GAAG,IAAI,EAAE,EAAE,CAAA;IAC3B,MAAM,gBAAgB,GAAG,IAAA,oBAAU,EAAC;QAChC,mBAAmB,EAAE,IAAI;QACzB,6BAA6B,EAAE,IAAI;QACnC,yBAAyB,EAAE,QAAQ;KACtC,CAAC,CAAA;IAEF,OAAO,CACH,uCACI,SAAS,EAAC,kBAAkB,uBACT,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI;QAChD,0CACI,SAAS,EAAE,gBAAgB,+BACA,QAAQ,CAAC,CAAC,CAAC,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,KAAK,CAAC,CAAC,CAAC,IAAI,gCACrC,QAAQ,CAAC,CAAC,CAAC,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,MAAM,CAAC,CAAC,CAAC,IAAI;YACnE,qCAAG,IAAI,EAAE,UAAU;gBACf,8DACoB,UAAU,sBACR,EAAE,wBACA,IAAI;oBACxB,8BAAC,gBAAgB,IAAC,EAAE,EAAE,EAAE,GAAI;oBAC5B,uCACI,GAAG,EAAE,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,GAAG,EACvB,GAAG,EAAE,WAAW,GAAG,CACjB,CACV,CACC,CACP,CACT,CAAA;AACL,CAAC;AA9BD,2BA8BC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Flourish/index.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AACzB,4DAAmC;AAQnC,MAAM,gBAAgB,GAAG,CAAC,EAAE,EAAE,EAAmB,EAAE,EAAE,CAAC,CACpD,uCACE,EAAE,EAAE,EAAE,EACN,SAAS,EAAC,mEAAmE,sBAC5D,WAAW;IAE5B,uCAAK,SAAS,EAAC,sBAAsB;QACnC,uCAAK,SAAS,EAAC,oBAAoB;YACjC,qCAAG,SAAS,EAAC,yBAAyB,kJAIlC,CACA,CACF,CACF,CACP,CAAA;AACD,SAAwB,QAAQ,CAAC,EAC/B,EAAE,EACF,YAAY,EACZ,WAAW,EACX,WAAW,EACX,aAAa,GAC2B;IACxC,MAAM,UAAU,GAAG,IAAI,EAAE,EAAE,CAAA;IAC3B,MAAM,QAAQ,GAAG,WAAW,KAAK,MAAM,CAAA;IACvC,MAAM,gBAAgB,GAAG,IAAA,oBAAU,EAAC;QAClC,mBAAmB,EAAE,IAAI;QACzB,6BAA6B,EAAE,IAAI;QACnC,yBAAyB,EAAE,QAAQ;KACpC,CAAC,CAAA;IAEF,OAAO,CACL,uCACE,SAAS,EAAC,kBAAkB,uBACT,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI;QAEhD,0CACE,SAAS,EAAE,gBAAgB,+BACA,QAAQ,CAAC,CAAC,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,gCACrC,QAAQ,CAAC,CAAC,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI;YAEnE,qCAAG,IAAI,EAAE,UAAU;gBACjB,8DACkB,UAAU,sBACR,EAAE,wBACA,YAAY;oBAEhC,8BAAC,gBAAgB,IAAC,EAAE,EAAE,EAAE,GAAI;oBAC5B,uCAAK,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,GAAG,EAAE,WAAW,GAAI,CAC1C,CACR,CACG,CACL,CACP,CAAA;AACH,CAAC;AAtCD,2BAsCC"}
@@ -0,0 +1,6 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ContentTree } from '@financial-times/content-tree';
3
+ declare const _default: (props: ContentTree.Heading & {
4
+ children: ReactNode[];
5
+ }) => JSX.Element;
6
+ export default _default;
@@ -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
- export default function ImageSet(fragment: ImageSetFragment): JSX.Element;
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 srcSet = (image) => image.sources.map((src) => `${src.url} ${src.dpr}x`).join(',');
8
+ const formatSourceSet = (image) => image.sourceSet.map((src) => `${src.url} ${src.dpr}x`).join(',');
8
9
  const figureClassNameMap = {
9
- PictureFullBleed: 'n-content-picture n-content-picture--wide n-content-layout__container',
10
- PictureInline: 'n-content-image n-content-image--inline',
11
- PictureStandard: 'n-content-image n-content-image--full',
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
- function Source({ image }) {
14
- const media = [
15
- image.minDisplayWidth && `(min-width: ${image.minDisplayWidth})`,
16
- image.maxDisplayWidth && `(max-width: ${image.maxDisplayWidth})`,
17
- ]
18
- .filter(Boolean)
19
- .join(' and ');
20
- // only need to have sources for different screen breakpoints
21
- if (!media.length)
22
- return null;
23
- return (react_1.default.createElement("source", { media: media, srcSet: srcSet(image), width: image.originalWidth, height: image.originalHeight }));
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 Image({ image, alt, type }) {
26
- const props = {
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
- const isValidImage = (image) => Boolean(image) && image !== 'PictureImages';
37
- const validImages = (images) => Object.values(images).filter(isValidImage);
38
- function Figure({ picture }) {
39
- if (!picture.images) {
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
- const pictureImages = validImages(picture.images);
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 ImageSet(fragment) {
55
- if (fragment.picture.__typename === 'PictureFullBleed') {
56
- return (react_1.default.createElement("div", { className: "n-content-layout", "data-layout-width": "full-grid" },
57
- react_1.default.createElement(Figure, { ...fragment })));
58
- }
59
- else {
60
- return react_1.default.createElement(Figure, { ...fragment });
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":";;;;;AAAA,kDAAyB;AAezB,MAAM,MAAM,GAAG,CAAC,KAAoB,EAAE,EAAE,CACtC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAEhE,MAAM,kBAAkB,GAAkD;IACxE,gBAAgB,EACd,uEAAuE;IACzE,aAAa,EAAE,yCAAyC;IACxD,eAAe,EAAE,uCAAuC;CACzD,CAAA;AAED,SAAS,MAAM,CAAC,EAAE,KAAK,EAA4B;IACjD,MAAM,KAAK,GAAG;QACZ,KAAK,CAAC,eAAe,IAAI,eAAe,KAAK,CAAC,eAAe,GAAG;QAChE,KAAK,CAAC,eAAe,IAAI,eAAe,KAAK,CAAC,eAAe,GAAG;KACjE;SACE,MAAM,CAAC,OAA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uCACE,SAAS,EACP,QAAQ,CAAC,OAAO,CAAC,WAAW,KAAK,WAAW,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,uBAErD,QAAQ,CAAC,OAAO,CAAC,WAAW;QAE/C,0CACE,SAAS,EACP,kBAAkB,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,iBAAiB;YAGvE;gBACE,8BAAC,OAAO,IAAC,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,GAAI;gBAC5C,8BAAC,aAAa,IACZ,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,aAAa,EACrC,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,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 { ReactNode } from 'react';
2
- declare type LayoutProps = {
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
- declare type LayoutSlotProps = {
11
- children: ReactNode;
12
- dataLayoutWidth: string;
13
- };
14
- export declare function Layout({ children, dataLayoutName, dataLayoutWidth, }: LayoutProps): JSX.Element;
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, dataLayoutWidth }: LayoutSlotProps): JSX.Element;
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, dataLayoutName, dataLayoutWidth, }) {
9
- return (react_1.default.createElement("div", { className: "n-content-layout", "data-layout-name": dataLayoutName, "data-layout-width": dataLayoutWidth }, children));
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, dataLayoutWidth }) {
17
- return (react_1.default.createElement("div", { className: "n-content-layout__slot", "data-layout-width": dataLayoutWidth }, children));
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":";;;;;;AAAA,kDAAwC;AAiBxC,SAAgB,MAAM,CAAC,EACrB,QAAQ,EACR,cAAc,EACd,eAAe,GACH;IACZ,OAAO,CACL,uCACE,SAAS,EAAC,kBAAkB,sBACV,cAAc,uBACb,eAAe,IAEjC,QAAQ,CACL,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,EAAE,eAAe,EAAmB;IACvE,OAAO,CACL,uCAAK,SAAS,EAAC,wBAAwB,uBAAoB,eAAe,IACvE,QAAQ,CACL,CACP,CAAA;AACH,CAAC;AAND,gCAMC"}
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
- const serialiser = new x_interaction_1.Serialiser();
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,kEAA0E;AAC1E,8EAAsE;AAItE,SAAwB,YAAY,CAAC,EAAE,OAAO,EAAa;IACzD,IAAI,OAAO,CAAC,UAAU,KAAK,iBAAiB;QAAE,OAAO,IAAI,CAAA;IACzD,MAAM,UAAU,GAAG,IAAI,0BAAU,EAAE,CAAA;IACnC,OAAO,CACL;QACE,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,UAAU,EAAE,UAAU,GACtB;QAEF,8BAAC,6BAAa,IAAC,UAAU,EAAE,UAAU,GAAI,CACxC,CACJ,CAAA;AACH,CAAC;AAhBD,+BAgBC"}
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"}