blob: 7bf15418c1fc9d41e155a013818607814babb0bb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
import { NextPage } from 'next';
import { AppProps } from 'next/app';
import { ReactElement, ReactNode } from 'react';
export type NextPageWithLayoutOptions = {
withExtraPadding?: boolean;
isHome?: boolean;
useGrid?: boolean;
};
export type NextPageWithLayout<T = {}> = NextPage<T> & {
getLayout?: (
page: ReactElement,
options: NextPageWithLayoutOptions
) => ReactNode;
};
export type AppPropsWithLayout = AppProps & {
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 Comment = {
approved: boolean;
content: string;
id: number;
meta: CommentMeta;
parentId?: number;
replies: Comment[];
};
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;
};
|