Skip to content

Commit fcec645

Browse files
authored
Merge pull request #302 from deletidev/feature/#273-CV-monochrome-force-Create-soft-skills-section
Closed #273
2 parents d6bc453 + 1b9f2ab commit fcec645

File tree

9 files changed

+66
-0
lines changed

9 files changed

+66
-0
lines changed

packages/manfred2html/src/engine/cv-monochrome-force/html-parts/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ export * from './footer-section';
77
export * from './main-element-start';
88
export * from './main-element-end';
99
export * from './about-me-section';
10+
export * from './soft-skills-section';
1011
export * from './relevants-links-section';
1112
export * from './hard-skills-section';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './soft-skills-section.part';
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Language } from '@/model';
2+
import { SoftSkillsLabels } from './soft-skills-label.model';
3+
import { spanishSoftSkillsLabels } from './soft-skills-spanish-labels.const';
4+
import { englishSoftSkillsLabels } from './soft-skills-english-labels.const';
5+
6+
export const getLabels = (language: Language): SoftSkillsLabels => {
7+
switch (language) {
8+
case 'es':
9+
return spanishSoftSkillsLabels;
10+
case 'en':
11+
return englishSoftSkillsLabels;
12+
default:
13+
throw new Error(`Language not supported: ${language}`);
14+
}
15+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { SoftSkillsLabels } from './soft-skills-label.model';
2+
3+
export const englishSoftSkillsLabels: SoftSkillsLabels = {
4+
SOFT_SKILLS_HEADING: 'Soft skills',
5+
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export interface SoftSkillsLabels {
2+
SOFT_SKILLS_HEADING: string;
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { SoftSkillsLabels } from './soft-skills-label.model';
2+
3+
export const spanishSoftSkillsLabels: SoftSkillsLabels = {
4+
SOFT_SKILLS_HEADING: 'Habilidades',
5+
};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<%_ if (softSkillsCollection && softSkillsCollection.length !== 0) { -%>
2+
<section class="section soft-skills">
3+
<h2 class="title"><%- labels.SOFT_SKILLS_HEADING %></h2>
4+
<ul class="soft-skills__list">
5+
<%_ for (const item of softSkillsCollection) { -%>
6+
<li><%- item.skill.name %></li>
7+
<%_ } -%>
8+
</ul>
9+
</section>
10+
<%_ } -%>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import ejs from 'ejs';
2+
import { SoftSkillVM, mapFromCvToSoftSkillVm } from '@lemoncode/manfred-common/soft-skill-section';
3+
import { ISO_SPANISH_LANGUAGE } from '@/engine/engine.const';
4+
import { Settings, Language, ManfredAwesomicCV } from '@/model';
5+
import { getLabels } from './labels';
6+
import softSkillsSection from './soft-skills-section.ejs?raw';
7+
8+
export const generateSoftSkillsSection = (cv: ManfredAwesomicCV, settings: Settings): string => {
9+
const softSkillsSectionVm = mapFromCvToSoftSkillVm(cv);
10+
return generateSoftSkillsSectionInner(softSkillsSectionVm, settings.language);
11+
};
12+
13+
const generateSoftSkillsSectionInner = (
14+
softSkillsSectionVm: SoftSkillVM[],
15+
language: Language = ISO_SPANISH_LANGUAGE
16+
): string => {
17+
const rootObject = {
18+
softSkillsCollection: softSkillsSectionVm,
19+
labels: getLabels(language),
20+
};
21+
return ejs.render(softSkillsSection, rootObject);
22+
};

packages/manfred2html/src/engine/cv-monochrome-force/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
generateMainElementStart,
1010
generateMainElementEnd,
1111
generateAboutMeSection,
12+
generateSoftSkillsSection,
1213
generateRelevantsLinksSection,
1314
generateHardSkillsSection,
1415
} from './html-parts';
@@ -27,6 +28,7 @@ export const exportManfredJSonToCVMonochromeForceHTML = (
2728
const mainElementEnd = generateMainElementEnd();
2829
const relevantsLinksSection = generateRelevantsLinksSection(manfredJsonContent, settings);
2930
const aboutMeSection = generateAboutMeSection(manfredJsonContent, settings);
31+
const softSkillsSection = generateSoftSkillsSection(manfredJsonContent, settings);
3032
const hardSkillsSection = generateHardSkillsSection(manfredJsonContent, settings);
3133

3234
return `
@@ -35,6 +37,8 @@ export const exportManfredJSonToCVMonochromeForceHTML = (
3537
${profileSection}
3638
${headerElementEnd}
3739
${mainElementStart}
40+
${aboutMeSection}
41+
${softSkillsSection}
3842
${relevantsLinksSection}
3943
${aboutMeSection}
4044
${hardSkillsSection}

0 commit comments

Comments
 (0)