Skip to content

Commit

Permalink
Merge pull request #224 from migalko94/feature/#210-implement-experie…
Browse files Browse the repository at this point in the history
…nce-section-to-ejs

Feature/#210 implement experience section to ejs
  • Loading branch information
juanpms2 authored Oct 4, 2023
2 parents 486faa1 + debf9de commit b648c57
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<%_ if(experienceCollection && experienceCollection.length !== 0){ -%>
<section class="main__section">
<div class="main__section__header">
<h2>Experiencia</h2>
<hr class="divider" />
</div>
<%_ for(const experience of experienceCollection){ -%>
<div class="main__section__item">
<div class="dot-icon">
<svg
xmlns="http://www.w3.org/2000/svg"
width="8"
height="8"
viewBox="0 0 8 8"
fill="none"
>
<circle opacity="0.33" cx="4" cy="4" r="4" fill="#247A7E" />
</svg>
</div>
<div class="section__content">
<h3><%- experience.name %></h3>
<%_ if(experience.type) { -%>
<h4><%- experience.description %></h4>
<%_ } -%>
<div class="section__content__date">
<svg
xmlns="http://www.w3.org/2000/svg"
width="18"
height="18"
viewBox="0 0 18 18"
fill="none"
>
<path
opacity="0.75"
d="M4.33333 1V3M13.6667 1V3M1 15V5C1 4.46957 1.21071 3.96086 1.58579 3.58579C1.96086 3.21071 2.46957 3 3 3H15C15.5304 3 16.0391 3.21071 16.4142 3.58579C16.7893 3.96086 17 4.46957 17 5V15M1 15C1 15.5304 1.21071 16.0391 1.58579 16.4142C1.96086 16.7893 2.46957 17 3 17H15C15.5304 17 16.0391 16.7893 16.4142 16.4142C16.7893 16.0391 17 15.5304 17 15M1 15V8.33333C1 7.8029 1.21071 7.29419 1.58579 6.91912C1.96086 6.54405 2.46957 6.33333 3 6.33333H15C15.5304 6.33333 16.0391 6.54405 16.4142 6.91912C16.7893 7.29419 17 7.8029 17 8.33333V15M9 9.66667H9.00711V9.67378H9V9.66667ZM9 11.6667H9.00711V11.6738H9V11.6667ZM9 13.6667H9.00711V13.6738H9V13.6667ZM7 11.6667H7.00711V11.6738H7V11.6667ZM7 13.6667H7.00711V13.6738H7V13.6667ZM5 11.6667H5.00711V11.6738H5V11.6667ZM5 13.6667H5.00711V13.6738H5V13.6667ZM11 9.66667H11.0071V9.67378H11V9.66667ZM11 11.6667H11.0071V11.6738H11V11.6667ZM11 13.6667H11.0071V13.6738H11V13.6667ZM13 9.66667H13.0071V9.67378H13V9.66667ZM13 11.6667H13.0071V11.6738H13V11.6667Z"
stroke="#0D1418"
stroke-width="0.75"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
<p class="date"><%- new Date(experience.roles[0].startDate).toLocaleDateString(undefined, { year:"numeric", month:"short"})%> <%_ if(experience.roles[0].finishDate && experience.roles[0].finishDate.toLowerCase() !=='actualidad') { -%>
<%- "- "+new Date(experience.roles[0].finishDate).toLocaleDateString(undefined, { year:"numeric", month:"short"}) -%>
<%_ } else { -%>
- Actualidad
<%_}-%>
</p>
</div>
<%_ if(experience.type) { -%>
<p class="section__content__data">Tipo de organización: <b><%- experience.type %></b></p>
<%_ } -%>
<p class="section__content__data">Roles dentro de la empresa: <b><%- experience.roles[0].name %></b></p>
<%_ if(experience.roles[0].challenges && experience.roles[0].challenges.length !== 0) { -%>
<p class="section__content__data">Retos:</p>
<ul class="section__content__data section__content__data__ul">
<%_ for(const challenge of experience.roles[0].challenges){ -%>
<li><%- challenge.description %></li>
<%_ }-%>
</ul>
<%_ }-%>
</div>
</div>
<%_ }-%>
</section>
<%_ }-%>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import ejs from 'ejs';
import { ExperienceVm, mapFromMacCvToExperienceSectionVm } from '@lemoncode/manfred-common/experience-section';
import { ManfredAwesomicCV } from '@/model';
import experienceTemplate from './experience-section.ejs?raw';

export const generateExperiencesSection = (cv: ManfredAwesomicCV): string => {
const experienceSectionVm = mapFromMacCvToExperienceSectionVm(cv);

return generateExperienceSectionInner(experienceSectionVm);
};

const generateExperienceSectionInner = (experienceSectionVm: ExperienceVm[]): string => {
const rootObject = {
experienceCollection: experienceSectionVm,
};

return ejs.render(experienceTemplate, rootObject);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export* from './experience-section.part';
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@
display: flex;
padding: var(--spacing_base);
}
.date {
text-transform: capitalize;
}
@media (min-width: 728px) {
main {
padding: var(--spacing_32) var(--spacing_64);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ export * from './language-section';
export * from './hard-skills-section';
export * from './soft-skills-section';
export * from './about-me-section';
export * from './experience-section';
3 changes: 3 additions & 0 deletions packages/manfred2html/src/engine/template-b/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
generateHardSkillsSection,
generateSoftSkillsSection,
generateAboutMeSection,
generateExperiencesSection,
} from './html-parts';

export const exportManfredJSonToHTMLTemplateB = (manfredJsonContent: ManfredAwesomicCV, theme?: string): string => {
Expand All @@ -32,6 +33,7 @@ export const exportManfredJSonToHTMLTemplateB = (manfredJsonContent: ManfredAwes
const mainElementStart = generateMainElementStart();
const mainElementEnd = generateMainElementEnd();
const aboutMeSection = generateAboutMeSection(manfredJsonContent);
const experienceSection = generateExperiencesSection(manfredJsonContent);

return `
${htmlDocumentStart}
Expand All @@ -46,6 +48,7 @@ export const exportManfredJSonToHTMLTemplateB = (manfredJsonContent: ManfredAwes
${asideElementEnd}
${mainElementStart}
${aboutMeSection}
${experienceSection}
${mainElementEnd}
${htmlDocumentEnd}
`;
Expand Down

0 comments on commit b648c57

Please sign in to comment.