aboutsummaryrefslogtreecommitdiffstats
path: root/src/ts/types/app.ts
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-09-19 18:13:57 +0200
committerArmand Philippot <git@armandphilippot.com>2023-09-19 19:12:31 +0200
commit2faf2e34331703b3bdea3eb487cb8799c8d65377 (patch)
treededc6557ddaa8fedd42d9bdf77950f8f9168ebcb /src/ts/types/app.ts
parentd1fe9e2164fc5c8fd767b456eecc2a4eb929a33f (diff)
refactor(build): replace paths aliases with relative paths
Using paths aliases starting with "@" can be confusing and can lead to conflict with existings modules. I prefer to use relative paths to avoid extra configuration in tools because of these aliases.
Diffstat (limited to 'src/ts/types/app.ts')
-rw-r--r--src/ts/types/app.ts132
1 files changed, 0 insertions, 132 deletions
diff --git a/src/ts/types/app.ts b/src/ts/types/app.ts
deleted file mode 100644
index 64bb3af..0000000
--- a/src/ts/types/app.ts
+++ /dev/null
@@ -1,132 +0,0 @@
-import { NextPage } from 'next';
-import { AppProps as NextAppProps } from 'next/app';
-import { ReactElement, ReactNode } from 'react';
-import { MessageFormatElement } from 'react-intl';
-
-export type NextPageWithLayoutOptions = {
- withExtraPadding?: boolean;
- isHome?: boolean;
- useGrid?: boolean;
-};
-
-export type NextPageWithLayout<T = {}> = NextPage<T> & {
- getLayout?: (
- page: ReactElement,
- options: NextPageWithLayoutOptions
- ) => ReactNode;
-};
-
-// modified version - allows for custom pageProps type, falling back to 'any'
-type AppProps<P = any> = {
- pageProps: P;
-} & Omit<NextAppProps<P>, 'pageProps'>;
-
-type CustomPageProps = {
- translation: Record<string, string> | Record<string, MessageFormatElement[]>;
-};
-
-export type AppPropsWithLayout = AppProps<CustomPageProps> & {
- Component: NextPageWithLayout;
-};
-
-export type ContentKind =
- | 'article'
- | 'comment'
- | 'page'
- | 'project'
- | 'thematic'
- | 'topic';
-
-export type Author<T extends ContentKind> = {
- avatar?: Image;
- description?: T extends 'comment' ? never : string;
- name: string;
- website?: string;
-};
-
-export type CommentMeta = {
- author: Author<'comment'>;
- date: string;
-};
-
-export type SingleComment = {
- approved: boolean;
- content: string;
- id: number;
- meta: CommentMeta;
- parentId?: number;
- replies: SingleComment[];
-};
-
-export type Dates = {
- publication: string;
- update?: string;
-};
-
-export type Image = {
- alt: string;
- height: number;
- src: string;
- title?: string;
- width: number;
-};
-
-export type Repos = {
- github?: string;
- gitlab?: string;
-};
-
-export type SEO = {
- description: string;
- title: string;
-};
-
-export type PageKind = Exclude<ContentKind, 'comment'>;
-
-export type Meta<T extends PageKind> = {
- articles?: T extends 'thematic' | 'topic' ? Article[] : never;
- author?: T extends 'article' | 'page' ? Author<T> : never;
- commentsCount?: T extends 'article' ? number : never;
- cover?: Image;
- dates: Dates;
- license?: T extends 'project' ? string : never;
- repos?: T extends 'project' ? Repos : never;
- seo: SEO;
- tagline?: T extends 'project' ? string : never;
- technologies?: T extends 'project' ? string[] : never;
- thematics?: T extends 'article' | 'topic' ? PageLink[] : never;
- topics?: T extends 'article' | 'thematic' ? PageLink[] : never;
- website?: T extends 'topic' ? string : never;
- wordsCount: number;
-};
-
-export type Page<T extends PageKind> = {
- content: string;
- id: number | string;
- intro: string;
- meta: Meta<T>;
- slug: string;
- title: string;
-};
-
-export type PageLink = {
- id: number;
- logo?: Image;
- name: string;
- url: string;
-};
-
-export type Article = Page<'article'>;
-export type ArticleCard = Pick<Article, 'id' | 'slug' | 'title'> &
- Pick<Meta<'article'>, 'cover' | 'dates'>;
-export type Project = Page<'project'>;
-export type ProjectPreview = Omit<Page<'project'>, 'content'>;
-export type ProjectCard = Pick<Page<'project'>, 'id' | 'slug' | 'title'> & {
- meta: Pick<Meta<'project'>, 'cover' | 'dates' | 'tagline' | 'technologies'>;
-};
-export type Thematic = Page<'thematic'>;
-export type Topic = Page<'topic'>;
-
-export type Slug = {
- slug: string;
-};