Skip to content

Commit b68f3da

Browse files
authored
Merge pull request #100 from Financial-Times/recommended-list
ADSDEV-2449: add support for RecommendedList
2 parents af7397a + 3f77ec4 commit b68f3da

File tree

5 files changed

+131
-6
lines changed

5 files changed

+131
-6
lines changed

README.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ type BodyBlock =
102102
| ThematicBreak
103103
| Table
104104
| Recommended
105+
| RecommendedList
105106
| Tweet
106107
| Video
107108
| YoutubeVideo
@@ -436,8 +437,23 @@ interface Recommended extends Node {
436437

437438
_non normative note:_ historically, recommended links used to be a list of up to
438439
three content items. Testing later showed that having one more prominent link
439-
was more engaging, and Spark (and therefore content-tree)now only supports that
440-
use case.
440+
was more engaging. Only use `RecommendedList` if you explicitly need to display multiple links.
441+
442+
443+
### `RecommendedList`
444+
445+
446+
```ts
447+
interface RecommendedList extends Node {
448+
type: "recommended-list";
449+
heading?: string;
450+
children: Recommended[];
451+
}
452+
```
453+
454+
- RecommendedList represents a collection of Recommended items selected by editorial.
455+
- The `heading`, when present, is used where the purpose of the link is more
456+
specific than being "Related Content"
441457

442458
#### Teaser types
443459

@@ -489,6 +505,7 @@ type Teaser = {
489505
width: number
490506
height: number
491507
}
508+
clientName?: string
492509
}
493510
```
494511

content-tree.d.ts

Lines changed: 28 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 | Tweet | Video | YoutubeVideo | Text;
2+
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text;
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 {
@@ -110,6 +110,11 @@ export declare namespace ContentTree {
110110
teaserTitleOverride?: string;
111111
teaser: Teaser;
112112
}
113+
interface RecommendedList extends Node {
114+
type: "recommended-list";
115+
heading?: string;
116+
children: Recommended[];
117+
}
113118
type TeaserConcept = {
114119
apiUrl: string;
115120
directType: string;
@@ -145,6 +150,7 @@ export declare namespace ContentTree {
145150
width: number;
146151
height: number;
147152
};
153+
clientName?: string;
148154
};
149155
interface Tweet extends Node {
150156
id: string;
@@ -280,7 +286,7 @@ export declare namespace ContentTree {
280286
attributes: CustomCodeComponentAttributes;
281287
}
282288
namespace full {
283-
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo | Text;
289+
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text;
284290
type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width";
285291
type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link;
286292
interface Node {
@@ -391,6 +397,11 @@ export declare namespace ContentTree {
391397
teaserTitleOverride?: string;
392398
teaser: Teaser;
393399
}
400+
interface RecommendedList extends Node {
401+
type: "recommended-list";
402+
heading?: string;
403+
children: Recommended[];
404+
}
394405
type TeaserConcept = {
395406
apiUrl: string;
396407
directType: string;
@@ -426,6 +437,7 @@ export declare namespace ContentTree {
426437
width: number;
427438
height: number;
428439
};
440+
clientName?: string;
429441
};
430442
interface Tweet extends Node {
431443
id: string;
@@ -562,7 +574,7 @@ export declare namespace ContentTree {
562574
}
563575
}
564576
namespace transit {
565-
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo | Text;
577+
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text;
566578
type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width";
567579
type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link;
568580
interface Node {
@@ -671,6 +683,11 @@ export declare namespace ContentTree {
671683
heading?: string;
672684
teaserTitleOverride?: string;
673685
}
686+
interface RecommendedList extends Node {
687+
type: "recommended-list";
688+
heading?: string;
689+
children: Recommended[];
690+
}
674691
type TeaserConcept = {
675692
apiUrl: string;
676693
directType: string;
@@ -706,6 +723,7 @@ export declare namespace ContentTree {
706723
width: number;
707724
height: number;
708725
};
726+
clientName?: string;
709727
};
710728
interface Tweet extends Node {
711729
id: string;
@@ -829,7 +847,7 @@ export declare namespace ContentTree {
829847
}
830848
}
831849
namespace loose {
832-
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo | Text;
850+
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text;
833851
type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width";
834852
type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link;
835853
interface Node {
@@ -940,6 +958,11 @@ export declare namespace ContentTree {
940958
teaserTitleOverride?: string;
941959
teaser?: Teaser;
942960
}
961+
interface RecommendedList extends Node {
962+
type: "recommended-list";
963+
heading?: string;
964+
children: Recommended[];
965+
}
943966
type TeaserConcept = {
944967
apiUrl: string;
945968
directType: string;
@@ -975,6 +998,7 @@ export declare namespace ContentTree {
975998
width: number;
976999
height: number;
9771000
};
1001+
clientName?: string;
9781002
};
9791003
interface Tweet extends Node {
9801004
id: string;

schemas/body-tree.schema.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@
111111
{
112112
"$ref": "#/definitions/ContentTree.transit.Recommended"
113113
},
114+
{
115+
"$ref": "#/definitions/ContentTree.transit.RecommendedList"
116+
},
114117
{
115118
"$ref": "#/definitions/ContentTree.transit.Tweet"
116119
},
@@ -609,6 +612,30 @@
609612
],
610613
"type": "object"
611614
},
615+
"ContentTree.transit.RecommendedList": {
616+
"additionalProperties": false,
617+
"properties": {
618+
"children": {
619+
"items": {
620+
"$ref": "#/definitions/ContentTree.transit.Recommended"
621+
},
622+
"type": "array"
623+
},
624+
"data": {},
625+
"heading": {
626+
"type": "string"
627+
},
628+
"type": {
629+
"const": "recommended-list",
630+
"type": "string"
631+
}
632+
},
633+
"required": [
634+
"children",
635+
"type"
636+
],
637+
"type": "object"
638+
},
612639
"ContentTree.transit.ScrollyBlock": {
613640
"additionalProperties": false,
614641
"properties": {

schemas/content-tree.schema.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@
136136
{
137137
"$ref": "#/definitions/ContentTree.full.Recommended"
138138
},
139+
{
140+
"$ref": "#/definitions/ContentTree.full.RecommendedList"
141+
},
139142
{
140143
"$ref": "#/definitions/ContentTree.full.Tweet"
141144
},
@@ -1025,6 +1028,9 @@
10251028
"teaser": {
10261029
"additionalProperties": false,
10271030
"properties": {
1031+
"clientName": {
1032+
"type": "string"
1033+
},
10281034
"firstPublishedDate": {
10291035
"type": "string"
10301036
},
@@ -1229,6 +1235,30 @@
12291235
],
12301236
"type": "object"
12311237
},
1238+
"ContentTree.full.RecommendedList": {
1239+
"additionalProperties": false,
1240+
"properties": {
1241+
"children": {
1242+
"items": {
1243+
"$ref": "#/definitions/ContentTree.full.Recommended"
1244+
},
1245+
"type": "array"
1246+
},
1247+
"data": {},
1248+
"heading": {
1249+
"type": "string"
1250+
},
1251+
"type": {
1252+
"const": "recommended-list",
1253+
"type": "string"
1254+
}
1255+
},
1256+
"required": [
1257+
"children",
1258+
"type"
1259+
],
1260+
"type": "object"
1261+
},
12321262
"ContentTree.full.ScrollyBlock": {
12331263
"additionalProperties": false,
12341264
"properties": {

schemas/transit-tree.schema.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@
136136
{
137137
"$ref": "#/definitions/ContentTree.transit.Recommended"
138138
},
139+
{
140+
"$ref": "#/definitions/ContentTree.transit.RecommendedList"
141+
},
139142
{
140143
"$ref": "#/definitions/ContentTree.transit.Tweet"
141144
},
@@ -634,6 +637,30 @@
634637
],
635638
"type": "object"
636639
},
640+
"ContentTree.transit.RecommendedList": {
641+
"additionalProperties": false,
642+
"properties": {
643+
"children": {
644+
"items": {
645+
"$ref": "#/definitions/ContentTree.transit.Recommended"
646+
},
647+
"type": "array"
648+
},
649+
"data": {},
650+
"heading": {
651+
"type": "string"
652+
},
653+
"type": {
654+
"const": "recommended-list",
655+
"type": "string"
656+
}
657+
},
658+
"required": [
659+
"children",
660+
"type"
661+
],
662+
"type": "object"
663+
},
637664
"ContentTree.transit.ScrollyBlock": {
638665
"additionalProperties": false,
639666
"properties": {

0 commit comments

Comments
 (0)