Work history prelude and education
This commit is contained in:
parent
ea26f5fed9
commit
da0b5d2b86
10
src/components/portfolio/work.svelte
Normal file
10
src/components/portfolio/work.svelte
Normal file
@ -0,0 +1,10 @@
|
||||
<script>
|
||||
export let work
|
||||
</script>
|
||||
|
||||
<article>
|
||||
<h3>{work.name}</h3>
|
||||
<section class="description">
|
||||
{@html work.description}
|
||||
</section>
|
||||
</article>
|
@ -14,16 +14,30 @@ export async function get(req, res, next) {
|
||||
}
|
||||
|
||||
const parsed = fm(pageSource)
|
||||
const projects = (parsed.attributes.projects || []).map(project => ({
|
||||
...project,
|
||||
description: marked(project.description)
|
||||
}))
|
||||
const workHistory = (parsed.attributes.work_history || []).map(parseField('description'))
|
||||
const projects = (parsed.attributes.projects || [])
|
||||
.filter(project => project.displayed)
|
||||
.map(parseField('description'))
|
||||
const education = (parsed.attributes.education || [])
|
||||
.filter(education => education.displayed)
|
||||
.map(parseField('description'))
|
||||
|
||||
const response = {
|
||||
title: parsed.attributes.title,
|
||||
body: marked(parsed.body),
|
||||
workHistoryPrelude: marked(parsed.attributes.work_history_prelude),
|
||||
workHistory,
|
||||
projects,
|
||||
education,
|
||||
}
|
||||
|
||||
res.setHeader('Content-Type', 'application/json')
|
||||
res.end(JSON.stringify(response))
|
||||
}
|
||||
|
||||
function parseField(field) {
|
||||
return item => ({
|
||||
...item,
|
||||
[field]: marked(item[field])
|
||||
})
|
||||
}
|
@ -9,7 +9,7 @@
|
||||
</script>
|
||||
|
||||
<script>
|
||||
import Workhistory from '../../components/portfolio/workhistory.svelte';
|
||||
import Work from '../../components/portfolio/work.svelte';
|
||||
import Project from '../../components/portfolio/project.svelte';
|
||||
|
||||
export let content
|
||||
@ -27,7 +27,19 @@
|
||||
{@html content.body}
|
||||
</section>
|
||||
|
||||
<Workhistory />
|
||||
<section class="work-history">
|
||||
<h2>Work experience</h2>
|
||||
<section class="work-history-prelude">
|
||||
{@html content.workHistoryPrelude}
|
||||
</section>
|
||||
<ul>
|
||||
{#each content.workHistory as work}
|
||||
<li>
|
||||
<Work work={work} />
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section class="projects">
|
||||
<h2>Projects</h2>
|
||||
@ -39,3 +51,14 @@
|
||||
{/each}
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section class="education">
|
||||
<h2>Education</h2>
|
||||
<ul>
|
||||
{#each content.education as work}
|
||||
<li>
|
||||
<Work work={work} />
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
</section>
|
||||
|
@ -28,6 +28,7 @@ collections:
|
||||
fields:
|
||||
- { label: Title, name: title, widget: string }
|
||||
- { label: Body, name: body, widget: markdown }
|
||||
- { label: Work history prelude, name: work_history_prelude, widget: markdown }
|
||||
- label: Work history
|
||||
name: work_history
|
||||
widget: list
|
||||
@ -39,6 +40,7 @@ collections:
|
||||
widget: list
|
||||
fields:
|
||||
- { label: Project name, name: name, widget: string }
|
||||
- { label: Displayed, name: displayed, widget: boolean, default: true }
|
||||
- { label: Description, name: description, widget: markdown }
|
||||
- label: Image
|
||||
name: image
|
||||
@ -46,4 +48,11 @@ collections:
|
||||
fields:
|
||||
- { label: Source, name: source, widget: image, required: false }
|
||||
- { label: Image description, name: image_description, widget: string, required: false }
|
||||
- label: Education
|
||||
name: education
|
||||
widget: list
|
||||
fields:
|
||||
- { label: Institution, name: name, widget: string }
|
||||
- { label: Displayed, name: displayed, widget: boolean, default: true }
|
||||
- { label: Description, name: description, widget: markdown }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user