Skip to content

Commit

Permalink
Merge pull request #55 from Financial-Times/ci-2151-ccc
Browse files Browse the repository at this point in the history
ci-2151 update custom code component
  • Loading branch information
leannecornish-ft authored Sep 11, 2024
2 parents abdc26b + 84847aa commit 056af70
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 153 deletions.
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -720,23 +720,25 @@ interface Table extends Parent {
### CustomCodeComponent

```ts
interface CustomCodeComponent extends Parent {
type CustomCodeComponentAttributes = {
[key: string]: string | boolean | undefined
}

interface CustomCodeComponent extends Node {
/** Component type */
type: "custom-code-component"
/** Repository for the code of the component in the format "[github org]/[github repo]/[component name]". */
path: string
/** Semantic version of the code of the component, e.g. "^0.3.5". */
versionRange: string
/** Last date-time where the attributes for this block were modified, in ISO-8601 format. */
attributesLastModified: string
/** A unique identifier for this instance */
/** Id taken from the CAPI url */
id: string
/** How the component should be presented in the article page according to the column layout system */
layoutWidth: LayoutWidth
/** Repository for the code of the component in the format "[github org]/[github repo]/[component name]". */
external path: string
/** Semantic version of the code of the component, e.g. "^0.3.5". */
external versionRange: string
/** Last date-time when the attributes for this block were modified, in ISO-8601 format. */
external attributesLastModified: string
/** Configuration data to be passed to the component. */
attributes: {
[key: string]: string | boolean | undefined
}
children: (ImageSet | Paragraph | CustomCodeComponent)[]
external attributes: CustomCodeComponentAttributes
}
```

Expand Down
86 changes: 41 additions & 45 deletions content-tree.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,23 +252,24 @@ export declare namespace ContentTree {
children: [TableCaption, TableBody, TableFooter] | [TableCaption, TableBody] | [TableBody, TableFooter] | [TableBody];
columnSettings: TableColumnSettings[];
}
interface CustomCodeComponent extends Parent {
type CustomCodeComponentAttributes = {
[key: string]: string | boolean | undefined;
};
interface CustomCodeComponent extends Node {
/** Component type */
type: "custom-code-component";
/** Id taken from the CAPI url */
id: string;
/** How the component should be presented in the article page according to the column layout system */
layoutWidth: LayoutWidth;
/** Repository for the code of the component in the format "[github org]/[github repo]/[component name]". */
path: string;
/** Semantic version of the code of the component, e.g. "^0.3.5". */
versionRange: string;
/** Last date-time where the attributes for this block were modified, in ISO-8601 format. */
/** Last date-time when the attributes for this block were modified, in ISO-8601 format. */
attributesLastModified: string;
/** A unique identifier for this instance */
id: string;
/** How the component should be presented in the article page according to the column layout system */
layoutWidth: LayoutWidth;
/** Configuration data to be passed to the component. */
attributes: {
[key: string]: string | boolean | undefined;
};
children: (ImageSet | Paragraph | CustomCodeComponent)[];
attributes: CustomCodeComponentAttributes;
}
namespace full {
type BodyBlock = Paragraph | Heading | ImageSet | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo;
Expand Down Expand Up @@ -524,23 +525,24 @@ export declare namespace ContentTree {
children: [TableCaption, TableBody, TableFooter] | [TableCaption, TableBody] | [TableBody, TableFooter] | [TableBody];
columnSettings: TableColumnSettings[];
}
interface CustomCodeComponent extends Parent {
type CustomCodeComponentAttributes = {
[key: string]: string | boolean | undefined;
};
interface CustomCodeComponent extends Node {
/** Component type */
type: "custom-code-component";
/** Id taken from the CAPI url */
id: string;
/** How the component should be presented in the article page according to the column layout system */
layoutWidth: LayoutWidth;
/** Repository for the code of the component in the format "[github org]/[github repo]/[component name]". */
path: string;
/** Semantic version of the code of the component, e.g. "^0.3.5". */
versionRange: string;
/** Last date-time where the attributes for this block were modified, in ISO-8601 format. */
/** Last date-time when the attributes for this block were modified, in ISO-8601 format. */
attributesLastModified: string;
/** A unique identifier for this instance */
id: string;
/** How the component should be presented in the article page according to the column layout system */
layoutWidth: LayoutWidth;
/** Configuration data to be passed to the component. */
attributes: {
[key: string]: string | boolean | undefined;
};
children: (ImageSet | Paragraph | CustomCodeComponent)[];
attributes: CustomCodeComponentAttributes;
}
}
namespace transit {
Expand Down Expand Up @@ -792,23 +794,16 @@ export declare namespace ContentTree {
children: [TableCaption, TableBody, TableFooter] | [TableCaption, TableBody] | [TableBody, TableFooter] | [TableBody];
columnSettings: TableColumnSettings[];
}
interface CustomCodeComponent extends Parent {
type CustomCodeComponentAttributes = {
[key: string]: string | boolean | undefined;
};
interface CustomCodeComponent extends Node {
/** Component type */
type: "custom-code-component";
/** Repository for the code of the component in the format "[github org]/[github repo]/[component name]". */
path: string;
/** Semantic version of the code of the component, e.g. "^0.3.5". */
versionRange: string;
/** Last date-time where the attributes for this block were modified, in ISO-8601 format. */
attributesLastModified: string;
/** A unique identifier for this instance */
/** Id taken from the CAPI url */
id: string;
/** How the component should be presented in the article page according to the column layout system */
layoutWidth: LayoutWidth;
/** Configuration data to be passed to the component. */
attributes: {
[key: string]: string | boolean | undefined;
};
children: (ImageSet | Paragraph | CustomCodeComponent)[];
}
}
namespace loose {
Expand Down Expand Up @@ -1065,23 +1060,24 @@ export declare namespace ContentTree {
children: [TableCaption, TableBody, TableFooter] | [TableCaption, TableBody] | [TableBody, TableFooter] | [TableBody];
columnSettings: TableColumnSettings[];
}
interface CustomCodeComponent extends Parent {
type CustomCodeComponentAttributes = {
[key: string]: string | boolean | undefined;
};
interface CustomCodeComponent extends Node {
/** Component type */
type: "custom-code-component";
/** Repository for the code of the component in the format "[github org]/[github repo]/[component name]". */
path: string;
/** Semantic version of the code of the component, e.g. "^0.3.5". */
versionRange: string;
/** Last date-time where the attributes for this block were modified, in ISO-8601 format. */
attributesLastModified: string;
/** A unique identifier for this instance */
/** Id taken from the CAPI url */
id: string;
/** How the component should be presented in the article page according to the column layout system */
layoutWidth: LayoutWidth;
/** Repository for the code of the component in the format "[github org]/[github repo]/[component name]". */
path?: string;
/** Semantic version of the code of the component, e.g. "^0.3.5". */
versionRange?: string;
/** Last date-time when the attributes for this block were modified, in ISO-8601 format. */
attributesLastModified?: string;
/** Configuration data to be passed to the component. */
attributes: {
[key: string]: string | boolean | undefined;
};
children: (ImageSet | Paragraph | CustomCodeComponent)[];
attributes?: CustomCodeComponentAttributes;
}
}
}
41 changes: 2 additions & 39 deletions schemas/body-tree.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,55 +119,18 @@
},
"ContentTree.transit.CustomCodeComponent": {
"properties": {
"attributes": {
"additionalProperties": {
"type": [
"string",
"boolean"
]
},
"description": "Configuration data to be passed to the component.",
"type": "object"
},
"attributesLastModified": {
"description": "Last date-time where the attributes for this block were modified, in ISO-8601 format.",
"type": "string"
},
"children": {
"items": {
"anyOf": [
{
"$ref": "#/definitions/ContentTree.transit.Paragraph"
},
{
"$ref": "#/definitions/ContentTree.transit.ImageSet"
},
{
"$ref": "#/definitions/ContentTree.transit.CustomCodeComponent"
}
]
},
"type": "array"
},
"data": {},
"id": {
"description": "A unique identifier for this instance",
"description": "Id taken from the CAPI url",
"type": "string"
},
"layoutWidth": {
"$ref": "#/definitions/ContentTree.transit.LayoutWidth",
"description": "How the component should be presented in the article page according to the column layout system"
},
"path": {
"description": "Repository for the code of the component in the format \"[github org]/[github repo]/[component name]\".",
"type": "string"
},
"type": {
"const": "custom-code-component",
"type": "string"
},
"versionRange": {
"description": "Semantic version of the code of the component, e.g. \"^0.3.5\".",
"description": "Component type",
"type": "string"
}
},
Expand Down
21 changes: 3 additions & 18 deletions schemas/content-tree.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,28 +149,12 @@
"type": "object"
},
"attributesLastModified": {
"description": "Last date-time where the attributes for this block were modified, in ISO-8601 format.",
"description": "Last date-time when the attributes for this block were modified, in ISO-8601 format.",
"type": "string"
},
"children": {
"items": {
"anyOf": [
{
"$ref": "#/definitions/ContentTree.full.Paragraph"
},
{
"$ref": "#/definitions/ContentTree.full.ImageSet"
},
{
"$ref": "#/definitions/ContentTree.full.CustomCodeComponent"
}
]
},
"type": "array"
},
"data": {},
"id": {
"description": "A unique identifier for this instance",
"description": "Id taken from the CAPI url",
"type": "string"
},
"layoutWidth": {
Expand All @@ -183,6 +167,7 @@
},
"type": {
"const": "custom-code-component",
"description": "Component type",
"type": "string"
},
"versionRange": {
Expand Down
41 changes: 2 additions & 39 deletions schemas/transit-tree.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,55 +138,18 @@
},
"ContentTree.transit.CustomCodeComponent": {
"properties": {
"attributes": {
"additionalProperties": {
"type": [
"string",
"boolean"
]
},
"description": "Configuration data to be passed to the component.",
"type": "object"
},
"attributesLastModified": {
"description": "Last date-time where the attributes for this block were modified, in ISO-8601 format.",
"type": "string"
},
"children": {
"items": {
"anyOf": [
{
"$ref": "#/definitions/ContentTree.transit.Paragraph"
},
{
"$ref": "#/definitions/ContentTree.transit.ImageSet"
},
{
"$ref": "#/definitions/ContentTree.transit.CustomCodeComponent"
}
]
},
"type": "array"
},
"data": {},
"id": {
"description": "A unique identifier for this instance",
"description": "Id taken from the CAPI url",
"type": "string"
},
"layoutWidth": {
"$ref": "#/definitions/ContentTree.transit.LayoutWidth",
"description": "How the component should be presented in the article page according to the column layout system"
},
"path": {
"description": "Repository for the code of the component in the format \"[github org]/[github repo]/[component name]\".",
"type": "string"
},
"type": {
"const": "custom-code-component",
"type": "string"
},
"versionRange": {
"description": "Semantic version of the code of the component, e.g. \"^0.3.5\".",
"description": "Component type",
"type": "string"
}
},
Expand Down

0 comments on commit 056af70

Please sign in to comment.