Skip to content

Commit

Permalink
Merge pull request #301 from deletidev/feature/#272-CV-monochrome-for…
Browse files Browse the repository at this point in the history
…ce-Create-hard-skills-section

Closed #272
  • Loading branch information
juanpms2 authored Dec 15, 2023
2 parents 33ab993 + a44c6d7 commit d6bc453
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<%_ if (hardSkillsCollection && hardSkillsCollection.length !== 0) { -%>
<section class="section hard-skills">
<h2 class="title"><%- labels.HARD_SKILLS_HEADING %></h2>
<ul class="hard-skills__list">
<%_ for (const item of hardSkillsCollection) { -%>
<li class="chip chip-primary"><%- item.skill.name %></li>
<%_ } -%>
</ul>
</section>
<%_ } -%>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import ejs from 'ejs';
import { HardSkillVM, mapFromCvToHardSkillVm } from '@lemoncode/manfred-common/hard-skill-section';
import { ISO_SPANISH_LANGUAGE } from '@/engine/engine.const';
import { Settings, Language, ManfredAwesomicCV } from '@/model';
import { getLabels } from './labels';
import hardSkillsSection from './hard-skills-section.ejs?raw';

export const generateHardSkillsSection = (cv: ManfredAwesomicCV, settings: Settings): string => {
const hardSkillsSectionVm = mapFromCvToHardSkillVm(cv);
return generateHardSkillsSectionInner(hardSkillsSectionVm, settings.language);
};

const generateHardSkillsSectionInner = (
hardSkillsSectionVm: HardSkillVM[],
language: Language = ISO_SPANISH_LANGUAGE
): string => {
const rootObject = {
hardSkillsCollection: hardSkillsSectionVm,
labels: getLabels(language),
};
return ejs.render(hardSkillsSection, rootObject);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './hard-skills-section.parts';
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { HardSkillsLabels } from './hard-skills-label.model';

export const englishHardSkillsLabels: HardSkillsLabels = {
HARD_SKILLS_HEADING: 'Hard Skills',
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface HardSkillsLabels {
HARD_SKILLS_HEADING: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { HardSkillsLabels } from './hard-skills-label.model';

export const spanishHardSkillsLabels: HardSkillsLabels = {
HARD_SKILLS_HEADING: 'Competencias',
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Language } from '@/model';
import { HardSkillsLabels } from './hard-skills-label.model';
import { spanishHardSkillsLabels } from './hard-skills-spanish-labels.const';
import { englishHardSkillsLabels } from './hard-skills-english-labels.const';

export const getLabels = (language: Language): HardSkillsLabels => {
switch (language) {
case 'es':
return spanishHardSkillsLabels;
case 'en':
return englishHardSkillsLabels;
default:
throw new Error(`Language not supported: ${language}`);
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ export * from './main-element-start';
export * from './main-element-end';
export * from './about-me-section';
export * from './relevants-links-section';
export * from './hard-skills-section';
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const generateRelevantsLinksSectionInner = (
profile: profileSectionVm,
labels: getLabels(language),
};
console.log(profileSectionVm.emails);

return ejs.render(relevantsLinksSection, rootObject);
};
3 changes: 3 additions & 0 deletions packages/manfred2html/src/engine/cv-monochrome-force/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
generateMainElementEnd,
generateAboutMeSection,
generateRelevantsLinksSection,
generateHardSkillsSection,
} from './html-parts';

export const exportManfredJSonToCVMonochromeForceHTML = (
Expand All @@ -26,6 +27,7 @@ export const exportManfredJSonToCVMonochromeForceHTML = (
const mainElementEnd = generateMainElementEnd();
const relevantsLinksSection = generateRelevantsLinksSection(manfredJsonContent, settings);
const aboutMeSection = generateAboutMeSection(manfredJsonContent, settings);
const hardSkillsSection = generateHardSkillsSection(manfredJsonContent, settings);

return `
${htmlDocumentStart}
Expand All @@ -35,6 +37,7 @@ export const exportManfredJSonToCVMonochromeForceHTML = (
${mainElementStart}
${relevantsLinksSection}
${aboutMeSection}
${hardSkillsSection}
${mainElementEnd}
${footerSection}
${htmlDocumentEnd}
Expand Down

0 comments on commit d6bc453

Please sign in to comment.