lbry.tech/app/components/link-grid.js

37 lines
659 B
JavaScript
Raw Normal View History

"use strict";
2018-09-26 11:42:41 -05:00
2018-11-30 14:46:22 -06:00
// I M P O R T
2018-09-26 11:42:41 -05:00
import html from "choo/html";
2018-09-26 11:42:41 -05:00
// E X P O R T
2018-10-03 15:27:13 -05:00
export default links => {
2018-11-30 14:46:22 -06:00
const renderedLinks = links.map(link =>
2018-10-01 15:47:10 -05:00
returnLinkTemplate(link.title, link.description, link.destination, link.label));
return html`
2018-09-24 17:14:50 -04:00
<ul class="link-grid">
${renderedLinks}
</ul>
`;
2018-09-26 11:42:41 -05:00
};
// H E L P E R
function returnLinkTemplate(title, description, destination, label) {
return `
<li class="link-grid__link">
<p class="link-grid__title"><strong>${title}</strong></p>
<p class="link-grid__description">${description}</p>
<a class="link-grid__cta" href="${destination}">${label}</a>
</li>
`;
}