Skip to content

Commit

Permalink
update importTemplate
Browse files Browse the repository at this point in the history
  • Loading branch information
blopa committed Aug 10, 2024
1 parent a69dee1 commit a07eddb
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/pages/Resume.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,17 @@ const useStyles = makeStyles((theme) => ({
},
}));

const importTemplate = (template) =>
lazy(() =>
import(`../components/ResumeTemplates/${template}/Index`).catch(() =>
import('../components/ResumeTemplates/Default/Index')
)
);
const importTemplate = (template) => {
const templates = {
Default: import('../components/ResumeTemplates/Default/Index'),
// Compact: import('../components/ResumeTemplates/Compact/Index'),
// VanHack: import('../components/ResumeTemplates/VanHack/Index'),
};

return lazy(() => {
return templates[template];
});
};

const parseMarkdown = (obj) => {
if (typeof obj !== 'object' || obj === null) {
Expand Down Expand Up @@ -93,6 +98,7 @@ const ResumePage = () => {
useEffect(() => {
async function loadTemplate() {
const Template = await importTemplate(resumeTemplateName);
console.log('the template', resumeTemplateName, Template);
const jsonResume = {
...baseResume,
...convertToRegularObject(cloneDeep(toggleableJsonResume)),
Expand Down

0 comments on commit a07eddb

Please sign in to comment.