Specify typings for data
This commit is contained in:
parent
bf38e195ba
commit
d332339b68
9 changed files with 173 additions and 0 deletions
24
src/data/types/common.ts
Normal file
24
src/data/types/common.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
export type Icon = string;
|
||||
|
||||
export interface Detail {
|
||||
label: string;
|
||||
value: string | string[];
|
||||
}
|
||||
|
||||
export interface Social {
|
||||
name: string;
|
||||
icon: Icon;
|
||||
url: string;
|
||||
}
|
||||
|
||||
export interface Tag {
|
||||
name: string;
|
||||
icon?: Icon;
|
||||
url?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface SectionConfig {
|
||||
title: string;
|
||||
icon: Icon;
|
||||
}
|
||||
16
src/data/types/experience-section.ts
Normal file
16
src/data/types/experience-section.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import type { SectionConfig, Social, Tag } from './common';
|
||||
|
||||
interface ExperienceItem {
|
||||
role: string;
|
||||
company: string;
|
||||
startDate: Date;
|
||||
endDate: Date | null;
|
||||
description: string | string[];
|
||||
technologies: Tag[];
|
||||
socials: Social[];
|
||||
}
|
||||
|
||||
export interface ExperienceSection {
|
||||
items: ExperienceItem[];
|
||||
config: SectionConfig;
|
||||
}
|
||||
40
src/data/types/favorites-section.ts
Normal file
40
src/data/types/favorites-section.ts
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import type { SectionConfig } from './common';
|
||||
|
||||
interface Book {
|
||||
title: string;
|
||||
cover: string;
|
||||
author: string;
|
||||
url?: string;
|
||||
}
|
||||
|
||||
interface Person {
|
||||
name: string;
|
||||
image: string;
|
||||
url?: string;
|
||||
}
|
||||
|
||||
interface Video {
|
||||
title: string;
|
||||
thumbnail: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
interface Media {
|
||||
title: string;
|
||||
type: string;
|
||||
image: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
interface SubSection<Data> {
|
||||
title: string;
|
||||
data: Data;
|
||||
}
|
||||
|
||||
export interface FavoritesSection {
|
||||
config: SectionConfig;
|
||||
books: SubSection<Book>;
|
||||
people: SubSection<Person>;
|
||||
videos: SubSection<Video>;
|
||||
medias: SubSection<Media>;
|
||||
}
|
||||
17
src/data/types/index.ts
Normal file
17
src/data/types/index.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import type { ExperienceSection } from './experience-section';
|
||||
import type { FavoritesSection } from './favorites-section';
|
||||
import type { MainSection } from './main-section';
|
||||
import type { PortfolioSection } from './portfolio-section';
|
||||
import type { Seo } from './seo';
|
||||
import type { SkillsSection } from './skills-section';
|
||||
import type { TestimonialsSection } from './testimonials-section';
|
||||
|
||||
export interface Data {
|
||||
seo: Seo;
|
||||
main: MainSection;
|
||||
skills?: SkillsSection;
|
||||
experience?: ExperienceSection;
|
||||
portfolio?: PortfolioSection;
|
||||
testimonials?: TestimonialsSection;
|
||||
favorites?: FavoritesSection;
|
||||
}
|
||||
16
src/data/types/main-section.ts
Normal file
16
src/data/types/main-section.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import type { Detail, SectionConfig, Social, Tag } from './common';
|
||||
|
||||
export interface MainSection {
|
||||
image: string;
|
||||
fullName: string;
|
||||
role: string;
|
||||
details: Detail[];
|
||||
description: string;
|
||||
tags: Tag[];
|
||||
action: {
|
||||
label: string;
|
||||
url: string;
|
||||
};
|
||||
socials: Social[];
|
||||
config: Omit<SectionConfig, 'title'>;
|
||||
}
|
||||
28
src/data/types/portfolio-section.ts
Normal file
28
src/data/types/portfolio-section.ts
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import type { Detail, SectionConfig, Social, Tag } from './common';
|
||||
|
||||
interface Project {
|
||||
name: string;
|
||||
image?: string;
|
||||
startDate: Date;
|
||||
endDate: Date | null;
|
||||
details: Detail[];
|
||||
description: string;
|
||||
technologies: Tag[];
|
||||
socials: Social[];
|
||||
}
|
||||
|
||||
interface PortfolioFilter {
|
||||
byDetail?: string[];
|
||||
byTechnology?: boolean;
|
||||
byStartDate?: boolean;
|
||||
byEndDate?: boolean;
|
||||
}
|
||||
|
||||
interface PortfolioConfig extends SectionConfig {
|
||||
filter: PortfolioFilter | null;
|
||||
}
|
||||
|
||||
export interface PortfolioSection {
|
||||
projects: Project[];
|
||||
config: PortfolioConfig;
|
||||
}
|
||||
4
src/data/types/seo.ts
Normal file
4
src/data/types/seo.ts
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
export interface Seo {
|
||||
title: string;
|
||||
description: string;
|
||||
}
|
||||
15
src/data/types/skills-section.ts
Normal file
15
src/data/types/skills-section.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import type { SectionConfig, Tag } from './common';
|
||||
|
||||
interface LevelledSkill extends Tag {
|
||||
level: 1 | 2 | 3 | 4 | 5;
|
||||
}
|
||||
|
||||
interface SkillSet<SkillType> {
|
||||
title: string;
|
||||
skills: SkillType[];
|
||||
}
|
||||
|
||||
export interface SkillsSection {
|
||||
skillSets: SkillSet<Tag> | SkillSet<LevelledSkill>;
|
||||
config: SectionConfig;
|
||||
}
|
||||
13
src/data/types/testimonials-section.ts
Normal file
13
src/data/types/testimonials-section.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import type { SectionConfig } from './common';
|
||||
|
||||
interface Testimonial {
|
||||
image: string;
|
||||
author: string;
|
||||
relation: string;
|
||||
content: string;
|
||||
}
|
||||
|
||||
export interface TestimonialsSection {
|
||||
testimonials: Testimonial[];
|
||||
config: SectionConfig;
|
||||
}
|
||||
Loading…
Reference in a new issue