mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-13 16:22:59 +10:00
🚀 release v3.0.0
This commit is contained in:
54
client/templates/sectionMap.tsx
Normal file
54
client/templates/sectionMap.tsx
Normal file
@ -0,0 +1,54 @@
|
||||
import get from 'lodash/get';
|
||||
import React from 'react';
|
||||
import { validate } from 'uuid';
|
||||
|
||||
export type SectionProps = {
|
||||
path: string;
|
||||
titlePath?: string | string[];
|
||||
subtitlePath?: string | string[];
|
||||
headlinePath?: string | string[];
|
||||
keywordsPath?: string;
|
||||
};
|
||||
|
||||
const sectionMap = (Section: React.FC<SectionProps>): Record<string, JSX.Element> => ({
|
||||
work: <Section key="work" path="sections.work" titlePath="name" subtitlePath="position" />,
|
||||
education: (
|
||||
<Section
|
||||
key="education"
|
||||
path="sections.education"
|
||||
titlePath="institution"
|
||||
subtitlePath={['degree', 'area']}
|
||||
headlinePath="score"
|
||||
keywordsPath="courses"
|
||||
/>
|
||||
),
|
||||
awards: <Section key="awards" path="sections.awards" titlePath="title" subtitlePath="awarder" />,
|
||||
certifications: (
|
||||
<Section key="certifications" path="sections.certifications" titlePath="name" subtitlePath="issuer" />
|
||||
),
|
||||
publications: <Section key="publications" path="sections.publications" titlePath="name" subtitlePath="publisher" />,
|
||||
skills: <Section key="skills" path="sections.skills" titlePath="name" keywordsPath="keywords" />,
|
||||
languages: <Section key="languages" path="sections.languages" titlePath="name" />,
|
||||
interests: <Section key="interests" path="sections.interests" titlePath="name" keywordsPath="keywords" />,
|
||||
projects: (
|
||||
<Section
|
||||
key="projects"
|
||||
path="sections.projects"
|
||||
titlePath="name"
|
||||
subtitlePath="description"
|
||||
keywordsPath="keywords"
|
||||
/>
|
||||
),
|
||||
volunteer: <Section key="volunteer" path="sections.volunteer" titlePath="organization" subtitlePath="position" />,
|
||||
references: <Section key="references" path="sections.references" titlePath="name" subtitlePath="relationship" />,
|
||||
});
|
||||
|
||||
export const getSectionById = (id: string, Section: React.FC<SectionProps>): JSX.Element => {
|
||||
if (validate(id)) {
|
||||
return <Section key={id} path={`sections.${id}`} />;
|
||||
}
|
||||
|
||||
return get(sectionMap(Section), id);
|
||||
};
|
||||
|
||||
export default sectionMap;
|
||||
Reference in New Issue
Block a user