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'
|
|
|
|
|
|
|
|
const formatRoles = arr => Intl.ListFormat
|
|
|
|
? new Intl.ListFormat('en').format(arr)
|
|
|
|
: arr.join(', ')
|
|
|
|
|
|
|
|
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>
|
|
|
|
<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>
|
|
|
|
`
|
|
|
|
}
|