Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cv-x-wing-squadron-create-header-section #293

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface Props {
}

const DOWNLOAD_MESSAGE_TIMEOUT = 2500;
const DESING_OPTIONS: TemplateCV[] = ['Sith Elegance', 'Galactic CleanTech'];
const DESING_OPTIONS: TemplateCV[] = ['Sith Elegance', 'Galactic CleanTech', 'X-Wing Squadron'];
const LANGUAGE_OPTIONS: Language[] = ['es', 'en'];

export const ExportConfig: React.FC<Props> = props => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ describe('Testing profile-section.mapper.ts', () => {
fullname: ' ',
emails: [] as string[],
relevantLinks: [] as RelevantLinkVm[],
avatar: '',
regionLocation: '',
countryLocation: '',
};

// Act
Expand All @@ -101,6 +104,9 @@ describe('Testing profile-section.mapper.ts', () => {
fullname: ' ',
emails: [] as string[],
relevantLinks: [] as RelevantLinkVm[],
avatar: '',
regionLocation: '',
countryLocation: '',
};

// Act
Expand Down Expand Up @@ -132,6 +138,9 @@ describe('Testing profile-section.mapper.ts', () => {
fullname: ' ',
emails: [] as string[],
relevantLinks: [] as RelevantLinkVm[],
avatar: '',
regionLocation: '',
countryLocation: '',
};

// Act
Expand Down Expand Up @@ -163,6 +172,9 @@ describe('Testing profile-section.mapper.ts', () => {
fullname: ' ',
emails: [] as string[],
relevantLinks: [] as RelevantLinkVm[],
avatar: '',
regionLocation: '',
countryLocation: '',
};

// Act
Expand Down Expand Up @@ -203,6 +215,9 @@ describe('Testing profile-section.mapper.ts', () => {
fullname: ' ',
emails: [] as string[],
relevantLinks: [] as RelevantLinkVm[],
avatar: '',
regionLocation: '',
countryLocation: '',
};

// Act
Expand Down Expand Up @@ -244,6 +259,9 @@ describe('Testing profile-section.mapper.ts', () => {
fullname: ' ',
emails: [] as string[],
relevantLinks: [] as RelevantLinkVm[],
avatar: '',
regionLocation: '',
countryLocation: '',
};

// Act
Expand All @@ -270,9 +288,14 @@ describe('Testing profile-section.mapper.ts', () => {
title: 'Computer Science Bachelor',
description: 'Frontend developer',
birthday: '30/03/1990',
avatar: undefined,
avatar: {
link: '',
},
contact: theContact,
location: undefined,
location: {
country: '',
region: '',
},
};

const cv: ManfredAwesomicCV = {
Expand All @@ -295,6 +318,9 @@ describe('Testing profile-section.mapper.ts', () => {
fullname: 'John Doe',
emails: ['[email protected]', '[email protected]'] as string[],
relevantLinks: [theLink] as RelevantLinkVm[],
avatar: '',
regionLocation: '',
countryLocation: '',
};

// Act
Expand All @@ -304,4 +330,5 @@ describe('Testing profile-section.mapper.ts', () => {
});
});
});

export {};
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ export const mapFromMacCvToProfileSectionVm = (cv: ManfredAwesomicCV): ProfileSe
const relevantLinks = cv?.aboutMe?.relevantLinks
? mapRelevantLinksToVm(cv.aboutMe.relevantLinks as ManfredRelevantLink[])
: [];

const avatar = (cv?.aboutMe?.profile?.avatar?.link as string) ?? '';
const regionLocation = cv?.aboutMe?.profile?.location?.region ?? '';
const countryLocation = cv?.aboutMe?.profile?.location?.country ?? '';
return {
name,
surnames,
Expand All @@ -39,5 +41,8 @@ export const mapFromMacCvToProfileSectionVm = (cv: ManfredAwesomicCV): ProfileSe
fullname,
emails,
relevantLinks,
avatar,
regionLocation,
countryLocation,
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ export interface ProfileSectionVm {
fullname: string;
emails: string[];
relevantLinks: RelevantLinkVm[];
avatar: string;
regionLocation: string;
countryLocation: string;
}

export interface RelevantLinkVm {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
</header>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import ejs from 'ejs';
import headerElementEndTemplate from './header-element-end.ejs?raw';

export const generateHeaderElementEnd = (): string => ejs.render(headerElementEndTemplate);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './header-element-end.part';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<header>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import ejs from 'ejs';
import headerElementStartTemplate from './header-element-start.ejs?raw';

export const generateHeaderElementStart = (): string => ejs.render(headerElementStartTemplate);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './header-element-start.part';
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<%_ if (profile && profile !== 'undefined') { -%>
<%_ if (profile.avatar) { -%>
<img src="<%= profile?.avatar%>" alt="photo cv">
<%_ } -%>
<section class="header__content">
<div class="header__content__name">
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="10" viewBox="0 0 64 10" fill="none">
<path d="M1.10269e-06 5L64 5" stroke="#3BA0B7" stroke-width="9" />
</svg>
<h1><%= profile.name %> </h1>
<h2 class="surname"><%= profile?.surnames %></h2>
<p class="job-title"><%= profile?.title %></p>
</div>
<%_ if (profile.regionLocation) { -%>
<div class="header__content__address">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="24" viewBox="0 0 18 24" fill="none">
<g clip-path="url(#clip0_1762_1661)">
<path
d="M10.1109 23.4C12.5156 20.3906 18 13.0969 18 9C18 4.03125 13.9688 0 9 0C4.03125 0 0 4.03125 0 9C0 13.0969 5.48438 20.3906 7.88906 23.4C8.46562 24.1172 9.53438 24.1172 10.1109 23.4ZM14.2969 6.79688L8.29688 12.7969C7.85625 13.2375 7.14375 13.2375 6.70781 12.7969L3.70312 9.79688C3.2625 9.35625 3.2625 8.64375 3.70312 8.20781C4.14375 7.77188 4.85625 7.76719 5.29219 8.20781L7.49531 10.4109L12.7031 5.20312C13.1438 4.7625 13.8562 4.7625 14.2922 5.20312C14.7281 5.64375 14.7328 6.35625 14.2922 6.79219L14.2969 6.79688Z"
fill="#3BA0B7"
/>
</g>
<defs>
<clipPath id="clip0_1762_1661">
<rect width="18" height="24" fill="white" />
</clipPath>
</defs>
</svg>
<p><%= profile?.regionLocation %>, <%= profile?.countryLocation %></p>
</div>
<%_ } -%>
</section>
<%_ } -%>




Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { ManfredAwesomicCV } from '@/model';
import { ProfileSectionVm, mapFromMacCvToProfileSectionVm } from '@lemoncode/manfred-common/profile-section';
import headerSection from './header-section.ejs?raw';
import ejs from 'ejs';

export const generateHeaderSection = (cv: ManfredAwesomicCV): string => {
const profileSectionVm = mapFromMacCvToProfileSectionVm(cv);
return generateHeaderSectionInner(profileSectionVm);
};

const generateHeaderSectionInner = (profileSectionVm: ProfileSectionVm): string => {
const rootObject = {
profile: profileSectionVm,
};
return ejs.render(headerSection, rootObject);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './header-section.part';
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
export * from './html-document-start';
export * from './html-document-end';
export * from './header-element-start';
export * from './header-element-end';
export * from './header-section';
14 changes: 13 additions & 1 deletion packages/manfred2html/src/engine/cv-x-wing-squadron/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
import { ManfredAwesomicCV } from '@/model';
import { generateHtmlDocumentStart, generateHtmlDocumentEnd } from './html-parts';
import {
generateHtmlDocumentStart,
generateHtmlDocumentEnd,
generateHeaderElementEnd,
generateHeaderElementStart,
generateHeaderSection,
} from './html-parts';

export const exportManfredJsonToCVXWingHTML = (manfredJsonContent: ManfredAwesomicCV): string => {
const htmlDocumentStart = generateHtmlDocumentStart();
const htmlDocumentEnd = generateHtmlDocumentEnd();
const headerElementStart = generateHeaderElementStart();
const headerElementEnd = generateHeaderElementEnd();
const headerSection = generateHeaderSection(manfredJsonContent);

return `
${htmlDocumentStart}
${headerElementStart}
${headerSection}
${headerElementEnd}
${htmlDocumentEnd}
`;
};
3 changes: 3 additions & 0 deletions packages/manfred2html/src/engine/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ManfredAwesomicCV, ExportHTMLSettings } from '@/model';
import { mapExportHTMLSettingsToSettings } from '@/mappers';
import { exportManfredJSonToCVSithEleganceHTML } from './cv-sith-elegance';
import { exportManfredJSonToCVGalacticCleanTechHTML } from './cv-galactic-cleantech';
import { exportManfredJsonToCVXWingHTML } from './cv-x-wing-squadron';

export const exportHTMLTemplate = (
manfredJsonContent: ManfredAwesomicCV,
Expand All @@ -14,6 +15,8 @@ export const exportHTMLTemplate = (
return exportManfredJSonToCVSithEleganceHTML(manfredJsonContent, settings);
case 'Galactic CleanTech':
return exportManfredJSonToCVGalacticCleanTechHTML(manfredJsonContent, settings);
case 'X-Wing Squadron':
return exportManfredJsonToCVXWingHTML(manfredJsonContent);
default:
throw new Error('Template not found');
}
Expand Down
Loading