import html from 'choo/html'; import { starRating } from '../partials/starRating'; import { modal } from '../partials/modal'; export const resultDetails = (searchController, result) => { const { i18n } = searchController; const modalId = `result_${result.uri}`; const buttonHTML = html``; const modalContent = html`

Covers

${i18n.__('interaction.average_rating')}

${starRating(result.averageRating)} ${result.reviews.map(review => { return html`
${review.reviewer.name} ${review.reviewer.handle}
${review.date} ${starRating(Math.ceil(review.rating))}

${review.review}

${review.hearts}
`; })}

${i18n.__('search.see_book_details')}

`; return modal(modalId, searchController, modalContent, { styles: "width:90%;", buttonHTML, // This should be replaced with buttonHTML containing the ratings and number of reviews etc. headerText: result.name, }); }