Untitled

 avatar
unknown
typescript
2 months ago
1.1 kB
4
Indexable
// BOOKS
export type BookCategory = {
  documentId: string;
  name: string;
};

export type BookSubcategory = {
  id: string;
  name: string;
};

export type Text = {
  id?: string;
  type: 'normalText' | 'boldText';
  content: string;
};

export type UnorderedList = {
  id?: string;
  type: 'unorderedList';
  fullText: string;
  content: Text[];
};

export type Paragraph = {
  id?: string;
  type: 'paragraph';
  fullText: string;
  content: Text[];
};

export type Image = {
  id?: string;
  type: 'image';
  src: string;
};

export type PageTitle = {
  id?: string;
  type: 'pageTitle';
  content: string;
};

export type Subheader = {
  id?: string;
  type: 'subheader';
  content: string;
};

export type Spacing = {
  id?: string;
  type: 'spacing';
  size: number;
};

export type ChapterContentItem =
  | Paragraph
  | Image
  | PageTitle
  | Subheader
  | Spacing
  | UnorderedList;

export type Book = {
  _id: string;
  category: BookCategory;
  subcategory: BookSubcategory;
  chapterContent: ChapterContentItem[];
  i18nOriginal?: i18nOriginal;
  i18nTranslated?: i18nTranslated;
};
Leave a Comment