2023-01-30 02:38:45 +01:00
|
|
|
import html from '../utils/html.js'
|
|
|
|
import markdown from '../utils/markdown.js'
|
|
|
|
import Duration from './duration.js'
|
|
|
|
import Link from './link.js'
|
|
|
|
|
2023-09-28 02:50:43 +02:00
|
|
|
/**
|
|
|
|
* @param {string[]} roles
|
|
|
|
* @returns {string}
|
|
|
|
*/
|
|
|
|
const formatRoles = roles => Intl.ListFormat
|
|
|
|
? new Intl.ListFormat('en').format(roles)
|
|
|
|
: roles.join(', ')
|
2023-01-30 02:38:45 +01:00
|
|
|
|
2023-09-28 02:50:43 +02:00
|
|
|
/**
|
|
|
|
* @param {import('../schema.d.ts').ResumeSchema['projects']} projects
|
|
|
|
* @returns {string | false}
|
|
|
|
*/
|
2023-01-30 02:38:45 +01:00
|
|
|
export default function Projects(projects = []) {
|
|
|
|
return projects.length > 0 && html`
|
|
|
|
<section id="projects">
|
|
|
|
<h3>Projects</h3>
|
|
|
|
<div class="stack">
|
2023-09-01 03:05:33 +02:00
|
|
|
${projects.map(({ description, entity, highlights = [], keywords = [], name, startDate, endDate, roles = [], type, url }) => html`
|
2023-01-30 02:38:45 +01:00
|
|
|
<article>
|
|
|
|
<header>
|
|
|
|
<h4>${Link(url, name)}</h4>
|
|
|
|
<div class="meta">
|
|
|
|
<div>
|
|
|
|
${roles.length > 0 && html`<strong>${formatRoles(roles)}</strong>`}
|
|
|
|
${entity && html`at <strong>${entity}</strong>`}
|
|
|
|
</div>
|
2023-09-28 02:50:43 +02:00
|
|
|
${startDate && html`<div>${Duration(startDate, endDate)}</div>`}
|
2023-09-01 03:05:33 +02:00
|
|
|
${type && html`<div>${type}</div>`}
|
2023-01-30 02:38:45 +01:00
|
|
|
</div>
|
|
|
|
</header>
|
|
|
|
${description && markdown(description)}
|
|
|
|
${highlights.length > 0 && html`
|
|
|
|
<ul>
|
|
|
|
${highlights.map(highlight => html`<li>${markdown(highlight)}</li>`)}
|
|
|
|
</ul>
|
|
|
|
`}
|
2023-09-01 03:05:33 +02:00
|
|
|
${keywords.length > 0 && html`
|
|
|
|
<ul class="tag-list">
|
|
|
|
${keywords.map(keyword => html`<li>${keyword}</li>`)}
|
|
|
|
</ul>
|
|
|
|
`}
|
2023-01-30 02:38:45 +01:00
|
|
|
</article>
|
|
|
|
`)}
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
`
|
|
|
|
}
|