diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-05-03 16:51:22 +0200 | 
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-05-03 16:51:22 +0200 | 
| commit | 83a029084f1bbfd78b7099d9bea3371d4533c6d9 (patch) | |
| tree | f99854e4cb430ccbdb725cb2e287423f80cb9791 /src/ts | |
| parent | 732d0943f8041d76262222a092b014f2557085ef (diff) | |
chore: add a LegalNotice page
Diffstat (limited to 'src/ts')
| -rw-r--r-- | src/ts/types/app.ts | 16 | ||||
| -rw-r--r-- | src/ts/types/mdx.ts | 20 | ||||
| -rw-r--r-- | src/ts/types/raw-data.ts | 6 | 
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;  | 
