Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
31 changes: 16 additions & 15 deletions SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -1016,20 +1016,24 @@ interface CarouselCard extends Node {
* @description unique identifier required for component tracking
*/
id: string
/**
* @description Heading (60 characters recommended)
*/
title: string
/**
* @description Image
* @sparkMapNodeType image
*/
children: [ImageSet]
/**
* @description Heading (60 characters recommended)
* @sparkMapNodeType textInput
*/
title: string
/**
* @description Body text (200 characters recommended)
* @sparkMapNodeType textInput
*/
copy: string
/**
* @description Details (optional, 60 characters recommended)
* @sparkMapNodeType textInput
*/
additionalInfo?: string
}
Expand All @@ -1048,16 +1052,6 @@ type CarouselChildren = CarouselCard[]
```
**CarouselChildren** the array of carousel cards that make up a carousel

#### `CarouselHeading`
```ts
interface CarouselHeading extends Node {
type: "carousel-heading"
title: string
standfirst?: string
}
```
**CarouselHeading** is the main header for a carousel component

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☝️ Remove the CarouselHeading node, because we've decided not to pursue more complex Beta Component features needed to auto-generate fields for it.

#### `Carousel`
```ts
/**
Expand All @@ -1069,7 +1063,14 @@ interface Carousel extends Parent {
* @description unique identifier required for component tracking
*/
id: string
heading?: CarouselHeading
/**
@sparkMapNodeType textInput
*/
title?: string
/**
@sparkMapNodeType textInput
*/
standfirst?: string

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☝️ Migrate the Title and Standfirst properties to the Carousel, rather than the CarouselHeading. Also, make both of these fields optional.

children: CarouselChildren
}
```
Expand Down
3 changes: 2 additions & 1 deletion build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
node tools/maketypes <SPEC.md> content-tree.ts
tsc -d content-tree.ts
typescript-json-schema --noExtraProps --required content-tree.ts ContentTree.full.Root > schemas/content-tree.schema.json
typescript-json-schema --validationKeywords sparkGenerateStoryblock sparkRepeater minItem maxItem --noExtraProps --required content-tree.ts ContentTree.transit.Root > schemas/transit-tree.schema.json
typescript-json-schema --noExtraProps --required content-tree.ts ContentTree.transit.Root > schemas/transit-tree.schema.json
typescript-json-schema --noExtraProps --required content-tree.ts ContentTree.transit.Body > schemas/body-tree.schema.json
typescript-json-schema --validationKeywords sparkMapNodeType sparkGenerateStoryblock sparkRepeater minItem maxItem --propOrder --noExtraProps --required content-tree.ts ContentTree.transit.Root > schemas/spark-transit-tree.schema.json

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☝️ We want to retain field order in Spark so that title appears near the top and not near the bottom of the generated story blocks. To do that, we need to preserve property order in the schema for Spark.

rm content-tree.ts
rm content-tree.js
104 changes: 64 additions & 40 deletions content-tree.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,20 +445,24 @@ export declare namespace ContentTree {
* @description unique identifier required for component tracking
*/
id: string;
/**
* @description Heading (60 characters recommended)
*/
title: string;
/**
* @description Image
* @sparkMapNodeType image
*/
children: [ImageSet];
/**
* @description Heading (60 characters recommended)
* @sparkMapNodeType textInput
*/
title: string;
/**
* @description Body text (200 characters recommended)
* @sparkMapNodeType textInput
*/
copy: string;
/**
* @description Details (optional, 60 characters recommended)
* @sparkMapNodeType textInput
*/
additionalInfo?: string;
}
Expand All @@ -469,11 +473,6 @@ export declare namespace ContentTree {
* @sparkRepeater true
*/
type CarouselChildren = CarouselCard[];
interface CarouselHeading extends Node {
type: "carousel-heading";
title: string;
standfirst?: string;
}
/**
* @sparkGenerateStoryblock true
*/
Expand All @@ -483,7 +482,14 @@ export declare namespace ContentTree {
* @description unique identifier required for component tracking
*/
id: string;
heading?: CarouselHeading;
/**
@sparkMapNodeType textInput
*/
title?: string;
/**
@sparkMapNodeType textInput
*/
standfirst?: string;
children: CarouselChildren;
}
namespace full {
Expand Down Expand Up @@ -933,20 +939,24 @@ export declare namespace ContentTree {
* @description unique identifier required for component tracking
*/
id: string;
/**
* @description Heading (60 characters recommended)
*/
title: string;
/**
* @description Image
* @sparkMapNodeType image
*/
children: [ImageSet];
/**
* @description Heading (60 characters recommended)
* @sparkMapNodeType textInput
*/
title: string;
/**
* @description Body text (200 characters recommended)
* @sparkMapNodeType textInput
*/
copy: string;
/**
* @description Details (optional, 60 characters recommended)
* @sparkMapNodeType textInput
*/
additionalInfo?: string;
}
Expand All @@ -957,11 +967,6 @@ export declare namespace ContentTree {
* @sparkRepeater true
*/
type CarouselChildren = CarouselCard[];
interface CarouselHeading extends Node {
type: "carousel-heading";
title: string;
standfirst?: string;
}
/**
* @sparkGenerateStoryblock true
*/
Expand All @@ -971,7 +976,14 @@ export declare namespace ContentTree {
* @description unique identifier required for component tracking
*/
id: string;
heading?: CarouselHeading;
/**
@sparkMapNodeType textInput
*/
title?: string;
/**
@sparkMapNodeType textInput
*/
standfirst?: string;
children: CarouselChildren;
}
}
Expand Down Expand Up @@ -1395,20 +1407,24 @@ export declare namespace ContentTree {
* @description unique identifier required for component tracking
*/
id: string;
/**
* @description Heading (60 characters recommended)
*/
title: string;
/**
* @description Image
* @sparkMapNodeType image
*/
children: [ImageSet];
/**
* @description Heading (60 characters recommended)
* @sparkMapNodeType textInput
*/
title: string;
/**
* @description Body text (200 characters recommended)
* @sparkMapNodeType textInput
*/
copy: string;
/**
* @description Details (optional, 60 characters recommended)
* @sparkMapNodeType textInput
*/
additionalInfo?: string;
}
Expand All @@ -1419,11 +1435,6 @@ export declare namespace ContentTree {
* @sparkRepeater true
*/
type CarouselChildren = CarouselCard[];
interface CarouselHeading extends Node {
type: "carousel-heading";
title: string;
standfirst?: string;
}
/**
* @sparkGenerateStoryblock true
*/
Expand All @@ -1433,7 +1444,14 @@ export declare namespace ContentTree {
* @description unique identifier required for component tracking
*/
id: string;
heading?: CarouselHeading;
/**
@sparkMapNodeType textInput
*/
title?: string;
/**
@sparkMapNodeType textInput
*/
standfirst?: string;
children: CarouselChildren;
}
}
Expand Down Expand Up @@ -1884,20 +1902,24 @@ export declare namespace ContentTree {
* @description unique identifier required for component tracking
*/
id: string;
/**
* @description Heading (60 characters recommended)
*/
title: string;
/**
* @description Image
* @sparkMapNodeType image
*/
children: [ImageSet];
/**
* @description Heading (60 characters recommended)
* @sparkMapNodeType textInput
*/
title: string;
/**
* @description Body text (200 characters recommended)
* @sparkMapNodeType textInput
*/
copy: string;
/**
* @description Details (optional, 60 characters recommended)
* @sparkMapNodeType textInput
*/
additionalInfo?: string;
}
Expand All @@ -1908,11 +1930,6 @@ export declare namespace ContentTree {
* @sparkRepeater true
*/
type CarouselChildren = CarouselCard[];
interface CarouselHeading extends Node {
type: "carousel-heading";
title: string;
standfirst?: string;
}
/**
* @sparkGenerateStoryblock true
*/
Expand All @@ -1922,7 +1939,14 @@ export declare namespace ContentTree {
* @description unique identifier required for component tracking
*/
id: string;
heading?: CarouselHeading;
/**
@sparkMapNodeType textInput
*/
title?: string;
/**
@sparkMapNodeType textInput
*/
standfirst?: string;
children: CarouselChildren;
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@financial-times/content-tree",
"description": "content tree format",
"version": "0.13.0",
"version": "0.14.0",
"publishConfig": {
"access": "public"
},
Expand Down
30 changes: 6 additions & 24 deletions schemas/body-tree.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,16 @@
"type": "array"
},
"data": {},
"heading": {
"$ref": "#/definitions/ContentTree.transit.CarouselHeading"
},
"id": {
"description": "unique identifier required for component tracking",
"type": "string"
},
"standfirst": {
"type": "string"
},
"title": {
"type": "string"
},
"type": {
"const": "carousel",
"type": "string"
Expand Down Expand Up @@ -329,27 +332,6 @@
],
"type": "object"
},
"ContentTree.transit.CarouselHeading": {
"additionalProperties": false,
"properties": {
"data": {},
"standfirst": {
"type": "string"
},
"title": {
"type": "string"
},
"type": {
"const": "carousel-heading",
"type": "string"
}
},
"required": [
"title",
"type"
],
"type": "object"
},
"ContentTree.transit.ClipSet": {
"additionalProperties": false,
"properties": {
Expand Down
Loading