2018-07-13 18:28:24 +02:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// P A C K A G E
|
|
|
|
|
2018-08-30 23:53:52 +02:00
|
|
|
import Component from "choo/component";
|
2018-07-13 18:28:24 +02:00
|
|
|
|
|
|
|
// V A R I A B L E
|
|
|
|
|
|
|
|
const links = [ // TODO: Update images
|
|
|
|
{
|
|
|
|
href: "https://discord.gg/YjYbwhS",
|
2018-08-25 00:30:58 +02:00
|
|
|
image: "//static.simpledesktops.com/static/images/sd-bg.png",
|
2018-07-13 18:28:24 +02:00
|
|
|
title: "Join us in chat"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
href: "https://lbry.io/developer",
|
2018-08-25 00:30:58 +02:00
|
|
|
image: "//static.simpledesktops.com/uploads/desktops/2017/02/28/GeoShapes_2880x1800.png",
|
2018-07-13 18:28:24 +02:00
|
|
|
title: "Join the developer email list"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
href: "https://lbry.io/meet",
|
2018-08-25 00:30:58 +02:00
|
|
|
image: "//static.simpledesktops.com/uploads/desktops/2016/12/05/Untitled-1-03-01.png",
|
2018-07-13 18:28:24 +02:00
|
|
|
title: "Host a meet-up"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
href: "https://www.reddit.com/r/lbry",
|
2018-08-25 00:30:58 +02:00
|
|
|
image: "//static.simpledesktops.com/uploads/desktops/2016/08/28/Wind-Vector-resize.png",
|
2018-07-13 18:28:24 +02:00
|
|
|
title: "Reddit"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
href: "https://lbry.fund",
|
2018-08-25 00:30:58 +02:00
|
|
|
image: "//static.simpledesktops.com/uploads/desktops/2015/08/20/Sunset_by_Banned.png",
|
2018-07-13 18:28:24 +02:00
|
|
|
title: "Get funding for a project"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
href: "https://lbry.io/join-us",
|
2018-08-25 00:30:58 +02:00
|
|
|
image: "//static.simpledesktops.com/uploads/desktops/2015/09/25/Siri.png",
|
2018-07-13 18:28:24 +02:00
|
|
|
title: "Get a job"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
href: "https://lbry.io/twitter",
|
|
|
|
title: "Twitter"
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-08-25 00:30:58 +02:00
|
|
|
// P R O G R A M
|
|
|
|
|
|
|
|
FeaturedLinks.prototype = Object.create(Component.prototype);
|
2018-07-13 18:28:24 +02:00
|
|
|
|
2018-08-25 00:30:58 +02:00
|
|
|
FeaturedLinks.prototype.createElement = () => {
|
2018-07-13 18:28:24 +02:00
|
|
|
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-07-13 18:28:24 +02:00
|
|
|
}
|
|
|
|
|
2018-08-25 00:30:58 +02:00
|
|
|
return `
|
|
|
|
<ul class="feature-links">${renderedLinks.join("")}</ul>
|
2018-07-13 18:28:24 +02:00
|
|
|
`;
|
|
|
|
};
|
2018-08-25 00:30:58 +02:00
|
|
|
|
2018-08-30 23:53:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
// E X P O R T
|
|
|
|
|
|
|
|
module.exports = exports = FeaturedLinks;
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-08-25 00:30:58 +02:00
|
|
|
// H E L P E R S
|
|
|
|
|
|
|
|
function FeaturedLinks() {
|
|
|
|
if (!(this instanceof FeaturedLinks)) return new FeaturedLinks();
|
|
|
|
Component.call(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
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>
|
|
|
|
`;
|
|
|
|
}
|