content text and dynamic zone components
This commit is contained in:
parent
44b55d9bbb
commit
3df3ba4ebc
22 changed files with 202 additions and 24 deletions
|
@ -1,5 +1,4 @@
|
|||
import type BaseImage from "../component/baseImage";
|
||||
import type BaseCollection from "./baseCollection";
|
||||
|
||||
export default interface Article extends BaseCollection {
|
||||
content: Array<{ type: string; children: Array<{ type: string; text: string }>; level?: number }>;
|
||||
}
|
||||
export default interface Article extends BaseCollection {}
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
import type BaseImage from "../component/baseImage";
|
||||
import type ContentField from "../field/content";
|
||||
|
||||
export default interface BaseCollection {
|
||||
id: number;
|
||||
documentId: string;
|
||||
|
@ -9,4 +12,8 @@ export default interface BaseCollection {
|
|||
updatedAt: string;
|
||||
publishedAt: string;
|
||||
locale: string;
|
||||
|
||||
content: ContentField | undefined;
|
||||
image: BaseImage | undefined;
|
||||
attachment: Array<BaseImage>;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import type BaseCollection from "./baseCollection";
|
||||
|
||||
export default interface Event extends BaseCollection {
|
||||
content: Array<{ type: string; children: Array<{ type: string; text: string }>; level?: number }>;
|
||||
image: undefined;
|
||||
content: undefined;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ export default interface Lookup {
|
|||
documentId: string;
|
||||
collection: string;
|
||||
reference: string;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
publishedAt: Date;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
publishedAt: string;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type BaseCollection from "./baseCollection";
|
||||
|
||||
export default interface Operation extends BaseCollection {
|
||||
content: Array<{ type: string; children: Array<{ type: string; text: string }>; level?: number }>;
|
||||
image: undefined;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import type ContentField from "../field/content";
|
||||
import type BaseComponent from "./baseComponent";
|
||||
import type BaseImage from "./baseImage";
|
||||
|
||||
export default interface DynamicZoneColumnImageText extends BaseComponent {
|
||||
__component: "dynamic-zone.column-image-text";
|
||||
text: Array<{ type: string; children: Array<{ type: string; text: string }> }>;
|
||||
text: ContentField;
|
||||
image_left: boolean;
|
||||
image: BaseImage;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import type ContentField from "../field/content";
|
||||
import type BaseComponent from "./baseComponent";
|
||||
|
||||
export default interface DynamicZoneDualColumnText extends BaseComponent {
|
||||
__component: "dynamic-zone.dual-column-text";
|
||||
left_side: Array<{ type: string; children: Array<{ type: string; text: string }> }>;
|
||||
right_side: Array<{ type: string; children: Array<{ type: string; text: string }> }>;
|
||||
left_side: ContentField;
|
||||
right_side: ContentField;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import type ContentField from "../field/content";
|
||||
import type BaseComponent from "./baseComponent";
|
||||
|
||||
export default interface DynamicZoneFullText extends BaseComponent {
|
||||
__component: "dynamic-zone.full-text";
|
||||
text: Array<{ type: string; children: Array<{ type: string; text: string }> }>;
|
||||
text: ContentField;
|
||||
}
|
||||
|
|
24
types/field/content.ts
Normal file
24
types/field/content.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
export default interface ContentField
|
||||
extends Array<
|
||||
| {
|
||||
type: "paragraph" | "heading" | "quote";
|
||||
children: Array<TypeField>;
|
||||
level?: number;
|
||||
}
|
||||
| {
|
||||
type: "list";
|
||||
format: "unordered" | "ordered";
|
||||
children: Array<{ type: "list-item"; children: Array<TypeField> }>;
|
||||
}
|
||||
> {}
|
||||
|
||||
export type TypeField = TextField | { type: "link"; url: string; children: Array<TextField> };
|
||||
|
||||
export type TextField = {
|
||||
type: "text";
|
||||
text: string;
|
||||
strikethrough?: boolean;
|
||||
underline?: boolean;
|
||||
italic?: boolean;
|
||||
bold?: boolean;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue