Merge pull request #146 from lbryio/link_refactor

refactor attempt
This commit is contained in:
netop:// ウェッブ 2018-09-25 10:01:32 -05:00 committed by GitHub
commit 33fccf2075
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 63 deletions

View file

@ -1,11 +1,5 @@
"use strict";
// P A C K A G E
import Component from "choo/component";
// V A R I A B L E S
const APPLICATIONS = require("./ecosystem/module-applications");
@ -16,13 +10,7 @@ const LIGHTHOUSE = require("./ecosystem/submodule-lighthouse");
const REFLECTOR = require("./ecosystem/submodule-reflector");
const WALLET = require("./ecosystem/submodule-wallet");
// P R O G R A M
Ecosystem.prototype = Object.create(Component.prototype);
Ecosystem.prototype.createElement = () => {
export default function () {
return `
<section class="ecosystem">
<aside class="ecosystem__submodules">
@ -43,18 +31,3 @@ Ecosystem.prototype.createElement = () => {
</section>
`;
};
// E X P O R T
module.exports = exports = Ecosystem;
// H E L P E R S
function Ecosystem() {
if (!(this instanceof Ecosystem)) return new Ecosystem();
Component.call(this);
}

View file

@ -1,11 +1,5 @@
"use strict";
// P A C K A G E
import Component from "choo/component";
// V A R I A B L E
const links = [ // TODO: Update images
@ -45,13 +39,7 @@ const links = [ // TODO: Update images
}
];
// P R O G R A M
FeaturedLinks.prototype = Object.create(Component.prototype);
FeaturedLinks.prototype.createElement = () => {
export default function () {
const renderedLinks = [];
let imageLink = "";
@ -65,21 +53,6 @@ FeaturedLinks.prototype.createElement = () => {
`;
};
// E X P O R T
module.exports = exports = FeaturedLinks;
// 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">

View file

@ -145,13 +145,8 @@ function partialFinder(markdownBody) {
if (fileExistsTest) {
const partialFunction = require(path.join(__dirname, "..", `./components/${filename}.js`));
if (filename === "ecosystem" || filename === "feature-links") {
const neatPartial = new partialFunction;
markdownBody = markdownBody.replace(partial, neatPartial.render());
}
else if (filename === "glossary-toc") markdownBody = markdownBody.replace(partial, partialFunction);
if (filename === "glossary-toc") markdownBody = markdownBody.replace(partial, partialFunction);
else markdownBody = markdownBody.replace(partial, partialFunction.default());
}