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`

Projects

${projects.map(({ description, entity, highlights = [], keywords = [], name, startDate, endDate, roles = [], type, url }) => html`

${Link(url, name)}

${roles.length > 0 && html`${formatRoles(roles)}`} ${entity && html`at ${entity}`}
${Duration(startDate, endDate)}
${type && html`
${type}
`}
${description && markdown(description)} ${highlights.length > 0 && html`
    ${highlights.map(highlight => html`
  • ${markdown(highlight)}
  • `)}
`} ${keywords.length > 0 && html`
    ${keywords.map(keyword => html`
  • ${keyword}
  • `)}
`}
`)}
` }