import html from '../utils/html.js' import markdown from '../utils/markdown.js' import Duration from './duration.js' import Link from './link.js' export default function Work(work = []) { const nestedWork = work.reduce((acc, { description, name, url, ...rest }) => { const prev = acc[acc.length - 1] if (prev && prev.name === name && prev.description === description && prev.url === url) prev.items.push(rest) else acc.push({ description, name, url, items: [rest] }) return acc }, []) return work.length > 0 && html`

Work

${nestedWork.map(({ description, name, url, items = [] }) => html`

${Link(url, name)}

${description && html`
${description}
`}
${items.map(({highlights = [], location, position, startDate, endDate, summary }) => html`
${position}
${Duration(startDate, endDate)}
${location && html`
${location}
`}
${summary && markdown(summary)} ${highlights.length > 0 && html`
    ${highlights.map(highlight => html`
  • ${markdown(highlight)}
  • `)}
`}
`)}
`)}
` }