Skip to content

Commit f76f222

Browse files
committed
wip: add demo topper definition
1 parent 158238b commit f76f222

File tree

6 files changed

+919
-1
lines changed

6 files changed

+919
-1
lines changed

README.md

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ Its content is limited to only other content-tree content.
168168
```ts
169169
interface Root extends Node {
170170
type: "root"
171+
topper: Topper
171172
body: Body
172173
}
173174
```
@@ -176,6 +177,65 @@ interface Root extends Node {
176177

177178
**Root** can be used as the _[root][term-root]_ of a _[tree][term-tree]_.
178179

180+
### `Topper`
181+
182+
```ts
183+
type TopperType =
184+
| 'DeepPortraitTopper'
185+
| 'DeepLandscapeTopper'
186+
| 'SplitTextTopper'
187+
| 'FullBleedTopper'
188+
| 'PodcastTopper'
189+
| 'OpinionTopper'
190+
| 'BrandedTopper'
191+
| 'BasicTopper'
192+
| 'TopperWithFlourish'
193+
| 'PartnerContentTopper'
194+
```
195+
196+
```ts
197+
interface Topper extends Parent {
198+
type: 'topper'
199+
topperType: TopperType
200+
backgroundColor: string // maybe a type? is this external??
201+
children: [Headline, Intro, TopperVisual?]
202+
}
203+
```
204+
**Topper** represents the topper of an article
205+
206+
### Headline
207+
208+
```ts
209+
interface Headline extends Parent {
210+
type: 'headline'
211+
children: Text[]
212+
external isLarge: boolean //is this external? it's based on some business logic, partly derived by topper type? should it be external?
213+
}
214+
```
215+
216+
**Headline** represents the title of the article as displayed on the article page
217+
218+
219+
### Intro
220+
221+
```ts
222+
interface Intro extends Parent {
223+
type: 'intro'
224+
children: [Text] | (Paragraph | List)[]
225+
}
226+
```
227+
The article **Intro** can be either a one-line standfirst, or a longer summary
228+
229+
### TopperVisual
230+
231+
```ts
232+
interface TopperVisual extends Parent {
233+
type: 'topper-visual'
234+
children: [CustomCodeComponent] | [ImageSet] // | ClipSet
235+
}
236+
```
237+
**TopperVisual** contains the visual element of the topper, which can be an image, clip, or custom component
238+
179239
### `Body`
180240

181241
```ts
@@ -748,7 +808,6 @@ interface CustomCodeComponent extends Node {
748808
- The basic interface in Spark to make reference to this system above (eg. the git repo URL or a public S3 bucket), and provide some data for it if necessary. This will be the Custom Component storyblock.
749809
- The data Spark receives from entering a specific ID will be used to render dynamic fields (the `attributes`).
750810

751-
752811
## License
753812

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

build.bash

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ tsc -d content-tree.ts
44
typescript-json-schema --noExtraProps --required content-tree.ts ContentTree.full.Root > schemas/content-tree.schema.json
55
typescript-json-schema --noExtraProps --required content-tree.ts ContentTree.transit.Root > schemas/transit-tree.schema.json
66
typescript-json-schema --noExtraProps --required content-tree.ts ContentTree.transit.Body > schemas/body-tree.schema.json
7+
typescript-json-schema --noExtraProps --required content-tree.ts ContentTree.transit.Topper > schemas/topper-tree.schema.json
78
rm content-tree.ts
89
rm content-tree.js

content-tree.d.ts

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,29 @@ export declare namespace ContentTree {
1111
}
1212
interface Root extends Node {
1313
type: "root";
14+
topper: Topper;
1415
body: Body;
1516
}
17+
type TopperType = 'DeepPortraitTopper' | 'DeepLandscapeTopper' | 'SplitTextTopper' | 'FullBleedTopper' | 'PodcastTopper' | 'OpinionTopper' | 'BrandedTopper' | 'BasicTopper' | 'TopperWithFlourish' | 'PartnerContentTopper';
18+
interface Topper extends Parent {
19+
type: 'topper';
20+
topperType: TopperType;
21+
backgroundColor: string;
22+
children: [Headline, Intro, TopperVisual?];
23+
}
24+
interface Headline extends Parent {
25+
type: 'headline';
26+
children: Text[];
27+
isLarge: boolean;
28+
}
29+
interface Intro extends Parent {
30+
type: 'intro';
31+
children: [Text] | (Paragraph | List)[];
32+
}
33+
interface TopperVisual extends Parent {
34+
type: 'topper-visual';
35+
children: [CustomCodeComponent] | [ImageSet];
36+
}
1637
interface Body extends Parent {
1738
type: "body";
1839
version: number;
@@ -284,8 +305,29 @@ export declare namespace ContentTree {
284305
}
285306
interface Root extends Node {
286307
type: "root";
308+
topper: Topper;
287309
body: Body;
288310
}
311+
type TopperType = 'DeepPortraitTopper' | 'DeepLandscapeTopper' | 'SplitTextTopper' | 'FullBleedTopper' | 'PodcastTopper' | 'OpinionTopper' | 'BrandedTopper' | 'BasicTopper' | 'TopperWithFlourish' | 'PartnerContentTopper';
312+
interface Topper extends Parent {
313+
type: 'topper';
314+
topperType: TopperType;
315+
backgroundColor: string;
316+
children: [Headline, Intro, TopperVisual?];
317+
}
318+
interface Headline extends Parent {
319+
type: 'headline';
320+
children: Text[];
321+
isLarge: boolean;
322+
}
323+
interface Intro extends Parent {
324+
type: 'intro';
325+
children: [Text] | (Paragraph | List)[];
326+
}
327+
interface TopperVisual extends Parent {
328+
type: 'topper-visual';
329+
children: [CustomCodeComponent] | [ImageSet];
330+
}
289331
interface Body extends Parent {
290332
type: "body";
291333
version: number;
@@ -558,8 +600,28 @@ export declare namespace ContentTree {
558600
}
559601
interface Root extends Node {
560602
type: "root";
603+
topper: Topper;
561604
body: Body;
562605
}
606+
type TopperType = 'DeepPortraitTopper' | 'DeepLandscapeTopper' | 'SplitTextTopper' | 'FullBleedTopper' | 'PodcastTopper' | 'OpinionTopper' | 'BrandedTopper' | 'BasicTopper' | 'TopperWithFlourish' | 'PartnerContentTopper';
607+
interface Topper extends Parent {
608+
type: 'topper';
609+
topperType: TopperType;
610+
backgroundColor: string;
611+
children: [Headline, Intro, TopperVisual?];
612+
}
613+
interface Headline extends Parent {
614+
type: 'headline';
615+
children: Text[];
616+
}
617+
interface Intro extends Parent {
618+
type: 'intro';
619+
children: [Text] | (Paragraph | List)[];
620+
}
621+
interface TopperVisual extends Parent {
622+
type: 'topper-visual';
623+
children: [CustomCodeComponent] | [ImageSet];
624+
}
563625
interface Body extends Parent {
564626
type: "body";
565627
version: number;
@@ -819,8 +881,29 @@ export declare namespace ContentTree {
819881
}
820882
interface Root extends Node {
821883
type: "root";
884+
topper: Topper;
822885
body: Body;
823886
}
887+
type TopperType = 'DeepPortraitTopper' | 'DeepLandscapeTopper' | 'SplitTextTopper' | 'FullBleedTopper' | 'PodcastTopper' | 'OpinionTopper' | 'BrandedTopper' | 'BasicTopper' | 'TopperWithFlourish' | 'PartnerContentTopper';
888+
interface Topper extends Parent {
889+
type: 'topper';
890+
topperType: TopperType;
891+
backgroundColor: string;
892+
children: [Headline, Intro, TopperVisual?];
893+
}
894+
interface Headline extends Parent {
895+
type: 'headline';
896+
children: Text[];
897+
isLarge?: boolean;
898+
}
899+
interface Intro extends Parent {
900+
type: 'intro';
901+
children: [Text] | (Paragraph | List)[];
902+
}
903+
interface TopperVisual extends Parent {
904+
type: 'topper-visual';
905+
children: [CustomCodeComponent] | [ImageSet];
906+
}
824907
interface Body extends Parent {
825908
type: "body";
826909
version: number;

0 commit comments

Comments
 (0)