bbuddy-ui/src/types/blogPost.ts

39 lines
1.3 KiB
TypeScript

import type { ChainModifiers, Entry, EntryFieldTypes, EntrySkeletonType, LocaleCode } from 'contentful'
import {Author, AuthorSkeleton} from "./author";
import {ContentImage} from "../lib/contentful/contentImage";
import {BlogPostCategorySkeleton} from "./blogPostCategory";
import {WidgetMedia, WidgetMediaSkeleton} from "./blogWidgets/widgetMedia";
import {WidgetParagraph, WidgetParagraphSkeleton} from "./blogWidgets/widgetParagraph";
export interface BlogPostFields {
title?: EntryFieldTypes.Symbol
slug: EntryFieldTypes.Symbol
excerpt: EntryFieldTypes.Symbol
listImage?: EntryFieldTypes.AssetLink
author?: AuthorSkeleton
category: BlogPostCategorySkeleton
createdAt?: EntryFieldTypes.Date
body?: Array<WidgetMediaSkeleton | WidgetParagraphSkeleton>
}
export interface BlogPostFields extends BlogPostFields{
body: Array<WidgetMediaSkeleton | WidgetParagraphSkeleton>
}
export interface BlogPost {
title: string
slug: string
excerpt: string
listImage: ContentImage | null
author: Author | null
category: string
createdAt: string
body: Array<WidgetMedia | WidgetParagraph>
}
export type BlogPostSkeleton = EntrySkeletonType<BlogPostFields, 'blogPost'>
export type BlogPostEntry<Modifiers extends ChainModifiers, Locales extends LocaleCode> = Entry<
BlogPostSkeleton,
Modifiers,
Locales
>