oxen-website/types/cms.ts

77 lines
1.5 KiB
TypeScript
Raw Normal View History

2021-02-02 06:28:00 +01:00
import { Document } from '@contentful/rich-text-types';
2021-02-04 07:19:04 +01:00
import { SideMenuItem } from '../state/navigation';
2021-02-02 06:28:00 +01:00
2021-01-29 03:50:49 +01:00
export type IAuthor = {
name: string;
2021-02-02 06:28:00 +01:00
avatar?: IFigureImage;
2021-01-29 03:50:49 +01:00
shortBio: string;
email: string;
2021-01-31 11:02:19 +01:00
// Eg. Marketing Researcher
position: string | null;
twitter: string | null;
facebook: string | null;
github: string | null;
2021-01-29 03:50:49 +01:00
};
export type IFigureImage = {
2021-01-31 11:02:19 +01:00
title: string | null;
description: string | null;
2021-01-29 03:50:49 +01:00
imageUrl: string;
2021-09-03 15:21:12 +02:00
width: string | number;
height: string | number;
2021-01-29 03:50:49 +01:00
};
2021-02-08 07:37:50 +01:00
export interface IPost {
2021-01-29 03:50:49 +01:00
id: string;
title: string;
subtitle: string;
2021-02-08 07:37:50 +01:00
description: string;
2021-02-02 06:28:00 +01:00
body: Document;
2021-01-29 03:50:49 +01:00
author?: IAuthor;
2021-09-19 04:27:09 +02:00
publishedDateISO: string;
2021-01-31 11:02:19 +01:00
publishedDate: string;
featureImage?: IFigureImage;
tags: Array<string>;
slug: string;
2021-02-08 07:37:50 +01:00
}
2021-02-02 06:28:00 +01:00
export function isPost(object: unknown): object is IPost {
return Object.prototype.hasOwnProperty.call(object, 'publishedDate');
}
2021-02-02 06:28:00 +01:00
export type BodyDocument = {
nodeType: 'document';
content: any;
};
2021-02-04 06:42:15 +01:00
export interface ISplitPage {
2021-02-04 07:19:04 +01:00
id: SideMenuItem;
2021-02-04 06:42:15 +01:00
label: string;
title: string;
body: Document;
hero?: IFigureImage;
}
2021-04-29 09:35:49 +02:00
2021-05-10 04:24:39 +02:00
export interface IFAQItem {
id: number;
question: string;
answer: Document;
}
2021-09-03 15:21:12 +02:00
export interface IFetchEntriesReturn {
entries: Array<any>;
total: number;
}
2021-09-15 06:08:23 +02:00
export type ITagList = {
[key: string]: string;
};
2021-09-03 15:21:12 +02:00
export interface IFetchBlogEntriesReturn extends IFetchEntriesReturn {
entries: Array<IPost>;
}
export interface IFetchFAQItemsReturn extends IFetchEntriesReturn {
entries: Array<IFAQItem>;
}