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

80 lines
1.9 KiB
JavaScript
Raw Normal View History

"use strict";
2018-09-26 18:42:41 +02:00
2018-10-10 19:56:35 +02:00
// U T I L
const links = [
{
2018-09-24 21:06:10 +02:00
href: "https://chat.lbry.io",
2018-10-09 23:28:18 +02:00
image: "https://spee.ch/b432346bfd641990f3dc3dbceda057b4ededa360/discord-bg.jpg",
2018-09-30 19:05:15 +02:00
title: "Chat (Discord)"
},
{
2018-09-30 19:05:15 +02:00
href: "https://discourse.lbry.io",
2018-10-09 23:28:18 +02:00
image: "https://spee.ch/e59dcbe6a533934eb82e73bb335b7e43cb8a9f7d/atmosphere.png",
2018-09-30 19:05:15 +02:00
title: "Developer Forum"
},
{
2018-09-30 19:05:15 +02:00
href: "https://lbry.fund",
2018-10-09 23:28:18 +02:00
image: "https://spee.ch/b29b4cb6495c9c2e6fc26113bcc92158ed408a35/pixelsunset.png",
2018-09-30 19:05:15 +02:00
title: "lbry.fund (Project Funding)"
},
{
href: "https://www.reddit.com/r/lbry",
2018-10-09 23:28:18 +02:00
image: "https://spee.ch/2357ab1464bcbba3458f4eabdad9644bcfd6f491/lines.png",
title: "Reddit"
},
{
href: "https://lbry.io/join-us",
2018-10-09 23:28:18 +02:00
image: "https://spee.ch/6db68b3ebf22386fcd9d04237d11bfaff5ba2a95/minimalisticrubikcube.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-10-09 23:28:18 +02:00
image: "https://spee.ch/9c38db124b85736adbcca48cdf34877d2110bbcd/GeoShapes.png",
title: "Twitter"
2018-10-09 23:28:18 +02:00
},
{
href: "https://www.facebook.com/lbryio",
image: "https://spee.ch/734404b89658e30af920829553b22d1742c0d99a/voice.png",
title: "Facebook"
}
];
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
`;
}