lbry.tech/app/components/feature-links.js

79 lines
1.8 KiB
JavaScript
Raw Normal View History

"use strict";
2018-09-26 18:42:41 +02:00
// V A R I A B L E
const links = [ // TODO: Update images
{
2018-09-24 21:06:10 +02:00
href: "https://chat.lbry.io",
2018-09-24 21:40:53 +02:00
image: "http://static.simpledesktops.com/static/images/sd-bg.png",
title: "Join us in chat"
},
{
href: "https://lbry.io/developer",
2018-09-24 21:40:53 +02:00
image: "http://static.simpledesktops.com/uploads/desktops/2017/02/28/GeoShapes_2880x1800.png",
title: "Join the developer email list"
},
{
href: "https://lbry.io/meet",
2018-09-24 21:40:53 +02:00
image: "http://static.simpledesktops.com/uploads/desktops/2016/12/05/Untitled-1-03-01.png",
title: "Host a meet-up"
},
{
href: "https://www.reddit.com/r/lbry",
2018-09-24 21:40:53 +02:00
image: "http://static.simpledesktops.com/uploads/desktops/2016/08/28/Wind-Vector-resize.png",
title: "Reddit"
},
{
href: "https://lbry.fund",
2018-09-24 21:40:53 +02:00
image: "http://static.simpledesktops.com/uploads/desktops/2015/08/20/Sunset_by_Banned.png",
title: "Get funding for a project"
},
{
href: "https://lbry.io/join-us",
2018-09-24 21:40:53 +02:00
image: "http://static.simpledesktops.com/uploads/desktops/2015/09/25/Siri.png",
title: "Get a job"
},
{
2018-09-24 21:06:10 +02:00
href: "https://twitter.com/lbryio",
title: "Twitter"
}
];
2018-09-26 18:42:41 +02:00
// E X P O R T
2018-09-24 20:55:14 +02:00
export default function () {
const renderedLinks = [];
let imageLink = "";
for (const link of links) {
2018-08-25 00:30:58 +02:00
if (link.image) imageLink = `<img alt="${link.title}" src="${link.image}"/>`;
renderedLinks.push(returnLinkTemplate(link.href, link.title, imageLink));
}
2018-08-25 00:30:58 +02:00
return `
<ul class="feature-links">${renderedLinks.join("")}</ul>
`;
2018-09-26 18:42:41 +02:00
}
// H E L P E R
2018-08-25 00:30:58 +02:00
function returnLinkTemplate(url, title, image) {
return `
<li class="feature-link">
<div>
<a class="feature-link__title" href="${url}" title="${title}">${title}</a>
</div>
<figure class="feature-link__background">
${image}
</figure>
</li>
`;
}