import html from '../utils/html.js' import markdown from '../utils/markdown.js' import Duration from './duration.js' import Link from './link.js' /** * @param {string[]} roles * @returns {string} */ const formatRoles = roles => Intl.ListFormat ? new Intl.ListFormat('en').format(roles) : roles.join(', ') /** * @param {import('../schema.d.ts').ResumeSchema['projects']} projects * @returns {string | false} */ 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}`}
${startDate && html`
${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}
  • `)}
`}
`)}
` }