Skip to content

Commit e6d13b8

Browse files
committed
feat: ci-3276 comparison and card
1 parent 4ed1162 commit e6d13b8

File tree

5 files changed

+335
-4
lines changed

5 files changed

+335
-4
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ type BodyBlock =
115115
| YoutubeVideo
116116
| Text
117117
| ImagePair
118+
| Comparison
118119
```
119120
120121
`BodyBlock` nodes are the only things that are valid as the top level of a `Body`.
@@ -699,6 +700,17 @@ interface LayoutImage extends Node {
699700
this was that in the bodyXML, layout nodes were inside an `<experimental>`
700701
tag, and that didn't support publishing `<ft-content>`.
701702

703+
### Card
704+
```ts
705+
interface Card extends Parent {
706+
type: "card"
707+
title?: string
708+
children: [ImageSet] | [Paragraph] | [ImageSet, Paragraph]
709+
}
710+
```
711+
712+
A card describes a subject with an image and a description. It can be an image on its own, a paragraph on its own, or both an image and a paragraph together. It cannot have an empty array for children.
713+
702714
### `Table`
703715

704716
```ts
@@ -799,6 +811,18 @@ interface ImagePair extends Parent {
799811

800812
**ImagePair** is a set of two images
801813

814+
### Comparison
815+
816+
```ts
817+
interface Comparison extends Parent {
818+
type: 'comparison'
819+
title?: string
820+
children: [Card, Card]
821+
}
822+
```
823+
824+
A comparison has 2 cards adjacent to each other
825+
802826
## License
803827

804828
This software is published by the Financial Times under the [MIT licence](mit).

content-tree.d.ts

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export declare namespace ContentTree {
2-
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | ImagePair;
2+
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | ImagePair | Comparison;
33
type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width";
44
type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link;
55
interface Node {
@@ -227,6 +227,11 @@ export declare namespace ContentTree {
227227
credit: string;
228228
picture: ImageSetPicture;
229229
}
230+
interface Card extends Parent {
231+
type: "card";
232+
title?: string;
233+
children: [ImageSet] | [Paragraph] | [ImageSet, Paragraph];
234+
}
230235
type TableColumnSettings = {
231236
hideOnMobile: boolean;
232237
sortable: boolean;
@@ -289,8 +294,13 @@ export declare namespace ContentTree {
289294
type: 'image-pair';
290295
children: [ImageSet, ImageSet];
291296
}
297+
interface Comparison extends Parent {
298+
type: 'comparison';
299+
title?: string;
300+
children: [Card, Card];
301+
}
292302
namespace full {
293-
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | ImagePair;
303+
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | ImagePair | Comparison;
294304
type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width";
295305
type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link;
296306
interface Node {
@@ -518,6 +528,11 @@ export declare namespace ContentTree {
518528
credit: string;
519529
picture: ImageSetPicture;
520530
}
531+
interface Card extends Parent {
532+
type: "card";
533+
title?: string;
534+
children: [ImageSet] | [Paragraph] | [ImageSet, Paragraph];
535+
}
521536
type TableColumnSettings = {
522537
hideOnMobile: boolean;
523538
sortable: boolean;
@@ -580,9 +595,14 @@ export declare namespace ContentTree {
580595
type: 'image-pair';
581596
children: [ImageSet, ImageSet];
582597
}
598+
interface Comparison extends Parent {
599+
type: 'comparison';
600+
title?: string;
601+
children: [Card, Card];
602+
}
583603
}
584604
namespace transit {
585-
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | ImagePair;
605+
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | ImagePair | Comparison;
586606
type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width";
587607
type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link;
588608
interface Node {
@@ -803,6 +823,11 @@ export declare namespace ContentTree {
803823
caption: string;
804824
credit: string;
805825
}
826+
interface Card extends Parent {
827+
type: "card";
828+
title?: string;
829+
children: [ImageSet] | [Paragraph] | [ImageSet, Paragraph];
830+
}
806831
type TableColumnSettings = {
807832
hideOnMobile: boolean;
808833
sortable: boolean;
@@ -857,9 +882,14 @@ export declare namespace ContentTree {
857882
type: 'image-pair';
858883
children: [ImageSet, ImageSet];
859884
}
885+
interface Comparison extends Parent {
886+
type: 'comparison';
887+
title?: string;
888+
children: [Card, Card];
889+
}
860890
}
861891
namespace loose {
862-
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | ImagePair;
892+
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | ImagePair | Comparison;
863893
type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width";
864894
type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link;
865895
interface Node {
@@ -1087,6 +1117,11 @@ export declare namespace ContentTree {
10871117
credit: string;
10881118
picture?: ImageSetPicture;
10891119
}
1120+
interface Card extends Parent {
1121+
type: "card";
1122+
title?: string;
1123+
children: [ImageSet] | [Paragraph] | [ImageSet, Paragraph];
1124+
}
10901125
type TableColumnSettings = {
10911126
hideOnMobile: boolean;
10921127
sortable: boolean;
@@ -1149,5 +1184,10 @@ export declare namespace ContentTree {
11491184
type: 'image-pair';
11501185
children: [ImageSet, ImageSet];
11511186
}
1187+
interface Comparison extends Parent {
1188+
type: 'comparison';
1189+
title?: string;
1190+
children: [Card, Card];
1191+
}
11521192
}
11531193
}

schemas/body-tree.schema.json

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@
128128
},
129129
{
130130
"$ref": "#/definitions/ContentTree.transit.ImagePair"
131+
},
132+
{
133+
"$ref": "#/definitions/ContentTree.transit.Comparison"
131134
}
132135
]
133136
},
@@ -145,6 +148,92 @@
145148
],
146149
"type": "object"
147150
},
151+
"ContentTree.transit.Card": {
152+
"additionalProperties": false,
153+
"properties": {
154+
"children": {
155+
"anyOf": [
156+
{
157+
"items": [
158+
{
159+
"$ref": "#/definitions/ContentTree.transit.ImageSet"
160+
}
161+
],
162+
"maxItems": 1,
163+
"minItems": 1,
164+
"type": "array"
165+
},
166+
{
167+
"items": [
168+
{
169+
"$ref": "#/definitions/ContentTree.transit.Paragraph"
170+
}
171+
],
172+
"maxItems": 1,
173+
"minItems": 1,
174+
"type": "array"
175+
},
176+
{
177+
"items": [
178+
{
179+
"$ref": "#/definitions/ContentTree.transit.ImageSet"
180+
},
181+
{
182+
"$ref": "#/definitions/ContentTree.transit.Paragraph"
183+
}
184+
],
185+
"maxItems": 2,
186+
"minItems": 2,
187+
"type": "array"
188+
}
189+
]
190+
},
191+
"data": {},
192+
"title": {
193+
"type": "string"
194+
},
195+
"type": {
196+
"const": "card",
197+
"type": "string"
198+
}
199+
},
200+
"required": [
201+
"children",
202+
"type"
203+
],
204+
"type": "object"
205+
},
206+
"ContentTree.transit.Comparison": {
207+
"additionalProperties": false,
208+
"properties": {
209+
"children": {
210+
"items": [
211+
{
212+
"$ref": "#/definitions/ContentTree.transit.Card"
213+
},
214+
{
215+
"$ref": "#/definitions/ContentTree.transit.Card"
216+
}
217+
],
218+
"maxItems": 2,
219+
"minItems": 2,
220+
"type": "array"
221+
},
222+
"data": {},
223+
"title": {
224+
"type": "string"
225+
},
226+
"type": {
227+
"const": "comparison",
228+
"type": "string"
229+
}
230+
},
231+
"required": [
232+
"children",
233+
"type"
234+
],
235+
"type": "object"
236+
},
148237
"ContentTree.transit.CustomCodeComponent": {
149238
"additionalProperties": false,
150239
"properties": {

schemas/content-tree.schema.json

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@
153153
},
154154
{
155155
"$ref": "#/definitions/ContentTree.full.ImagePair"
156+
},
157+
{
158+
"$ref": "#/definitions/ContentTree.full.Comparison"
156159
}
157160
]
158161
},
@@ -170,6 +173,92 @@
170173
],
171174
"type": "object"
172175
},
176+
"ContentTree.full.Card": {
177+
"additionalProperties": false,
178+
"properties": {
179+
"children": {
180+
"anyOf": [
181+
{
182+
"items": [
183+
{
184+
"$ref": "#/definitions/ContentTree.full.ImageSet"
185+
}
186+
],
187+
"maxItems": 1,
188+
"minItems": 1,
189+
"type": "array"
190+
},
191+
{
192+
"items": [
193+
{
194+
"$ref": "#/definitions/ContentTree.full.Paragraph"
195+
}
196+
],
197+
"maxItems": 1,
198+
"minItems": 1,
199+
"type": "array"
200+
},
201+
{
202+
"items": [
203+
{
204+
"$ref": "#/definitions/ContentTree.full.ImageSet"
205+
},
206+
{
207+
"$ref": "#/definitions/ContentTree.full.Paragraph"
208+
}
209+
],
210+
"maxItems": 2,
211+
"minItems": 2,
212+
"type": "array"
213+
}
214+
]
215+
},
216+
"data": {},
217+
"title": {
218+
"type": "string"
219+
},
220+
"type": {
221+
"const": "card",
222+
"type": "string"
223+
}
224+
},
225+
"required": [
226+
"children",
227+
"type"
228+
],
229+
"type": "object"
230+
},
231+
"ContentTree.full.Comparison": {
232+
"additionalProperties": false,
233+
"properties": {
234+
"children": {
235+
"items": [
236+
{
237+
"$ref": "#/definitions/ContentTree.full.Card"
238+
},
239+
{
240+
"$ref": "#/definitions/ContentTree.full.Card"
241+
}
242+
],
243+
"maxItems": 2,
244+
"minItems": 2,
245+
"type": "array"
246+
},
247+
"data": {},
248+
"title": {
249+
"type": "string"
250+
},
251+
"type": {
252+
"const": "comparison",
253+
"type": "string"
254+
}
255+
},
256+
"required": [
257+
"children",
258+
"type"
259+
],
260+
"type": "object"
261+
},
173262
"ContentTree.full.CustomCodeComponent": {
174263
"additionalProperties": false,
175264
"properties": {

0 commit comments

Comments
 (0)