aboutsummaryrefslogtreecommitdiffstats
path: root/src/ts/types
diff options
context:
space:
mode:
Diffstat (limited to 'src/ts/types')
-rw-r--r--src/ts/types/app.ts16
-rw-r--r--src/ts/types/mdx.ts20
-rw-r--r--src/ts/types/raw-data.ts6
3 files changed, 34 insertions, 8 deletions
diff --git a/src/ts/types/app.ts b/src/ts/types/app.ts
index b09f3d5..4d9c71c 100644
--- a/src/ts/types/app.ts
+++ b/src/ts/types/app.ts
@@ -1,8 +1,14 @@
-export type AuthorKind = 'page' | 'comment';
+export type ContentKind =
+ | 'article'
+ | 'comment'
+ | 'page'
+ | 'project'
+ | 'thematic'
+ | 'topic';
-export type Author<T extends AuthorKind> = {
+export type Author<T extends ContentKind> = {
avatar?: Image;
- description?: T extends 'page' ? string | undefined : never;
+ description?: T extends 'comment' ? never : string;
name: string;
website?: string;
};
@@ -44,11 +50,11 @@ export type SEO = {
title: string;
};
-export type PageKind = 'article' | 'project' | 'thematic' | 'topic';
+export type PageKind = Exclude<ContentKind, 'comment'>;
export type Meta<T extends PageKind> = {
articles?: T extends 'thematic' | 'topic' ? Article[] : never;
- author: Author<'page'>;
+ author?: T extends 'article' | 'page' ? Author<T> : never;
commentsCount?: T extends 'article' ? number : never;
cover?: Image;
dates: Dates;
diff --git a/src/ts/types/mdx.ts b/src/ts/types/mdx.ts
new file mode 100644
index 0000000..6b72f21
--- /dev/null
+++ b/src/ts/types/mdx.ts
@@ -0,0 +1,20 @@
+import { StaticImageData } from 'next/image';
+import { Meta } from './app';
+
+export type MDXData = {
+ file: string;
+ image: StaticImageData;
+};
+
+export type MDXPageMeta = Pick<Meta<'page'>, 'cover' | 'dates' | 'seo'> & {
+ intro: string;
+ title: string;
+};
+
+export type MDXProjectMeta = Omit<
+ Meta<'project'>,
+ 'readingTime' | 'wordsCount'
+> & {
+ intro: string;
+ title: string;
+};
diff --git a/src/ts/types/raw-data.ts b/src/ts/types/raw-data.ts
index 43a2453..7e12e7f 100644
--- a/src/ts/types/raw-data.ts
+++ b/src/ts/types/raw-data.ts
@@ -3,7 +3,7 @@
*/
import { NodeResponse, PageInfo } from '@services/graphql/api';
-import { AuthorKind } from './app';
+import { ContentKind } from './app';
export type ACFPosts = {
postsInThematic?: RawThematicPreview[];
@@ -29,8 +29,8 @@ export type Info = {
wordsCount: number;
};
-export type RawAuthor<T extends AuthorKind> = {
- description?: T extends 'page' ? string | undefined : never;
+export type RawAuthor<T extends ContentKind> = {
+ description?: T extends 'comment' ? never : string;
gravatarUrl?: string;
name: string;
url?: string;