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 = [], name, startDate, endDate, roles = [], url }) => html`

${Link(url, name)}

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