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

75 lines
1.7 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-30 19:05:15 +02:00
image: "http://static.simpledesktops.com/uploads/desktops/2016/12/05/Untitled-1-03-01.png",
title: "Chat (Discord)"
},
{
2018-09-30 19:05:15 +02:00
href: "https://discourse.lbry.io",
2018-09-24 21:40:53 +02:00
image: "http://static.simpledesktops.com/uploads/desktops/2017/02/28/GeoShapes_2880x1800.png",
2018-09-30 19:05:15 +02:00
title: "Developer Forum"
},
{
2018-09-30 19:05:15 +02:00
href: "https://lbry.fund",
image: "http://static.simpledesktops.com/uploads/desktops/2015/08/20/Sunset_by_Banned.png",
title: "lbry.fund (Project Funding)"
},
{
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.io/join-us",
2018-09-24 21:40:53 +02:00
image: "http://static.simpledesktops.com/uploads/desktops/2015/09/25/Siri.png",
2018-09-30 19:05:15 +02:00
title: "Join Our Team"
},
{
2018-09-24 21:06:10 +02:00
href: "https://twitter.com/lbryio",
2018-09-30 19:05:15 +02:00
image: "http://static.simpledesktops.com/static/images/sd-bg.png",
title: "Twitter"
}
];
2018-09-26 18:42:41 +02:00
// E X P O R T
2018-10-03 22:27:13 +02:00
export default () => {
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 `
2018-09-30 19:05:15 +02:00
<div class="feature-links">${renderedLinks.join("")}</div>
`;
2018-10-03 22:27:13 +02:00
};
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 `
2018-09-30 19:05:15 +02:00
<a class="feature-link" href="${url}" title="${title}">
<h3 class="feature-link__title">
<span class="feature-link__title-inner">${title}</span>
</h3>
2018-08-25 00:30:58 +02:00
<figure class="feature-link__background">
${image}
</figure>
2018-09-30 19:05:15 +02:00
</a>
2018-08-25 00:30:58 +02:00
`;
}