refactor attempt #146

Merged
kauffj merged 2 commits from link_refactor into master 2018-09-25 17:01:33 +02:00
3 changed files with 4 additions and 63 deletions

View file

@ -1,11 +1,5 @@
"use strict"; "use strict";
// P A C K A G E
import Component from "choo/component";
// V A R I A B L E S // V A R I A B L E S
const APPLICATIONS = require("./ecosystem/module-applications"); const APPLICATIONS = require("./ecosystem/module-applications");
@ -16,13 +10,7 @@ const LIGHTHOUSE = require("./ecosystem/submodule-lighthouse");
const REFLECTOR = require("./ecosystem/submodule-reflector"); const REFLECTOR = require("./ecosystem/submodule-reflector");
const WALLET = require("./ecosystem/submodule-wallet"); const WALLET = require("./ecosystem/submodule-wallet");
export default function () {
// P R O G R A M
Ecosystem.prototype = Object.create(Component.prototype);
Ecosystem.prototype.createElement = () => {
return ` return `
<section class="ecosystem"> <section class="ecosystem">
<aside class="ecosystem__submodules"> <aside class="ecosystem__submodules">
@ -43,18 +31,3 @@ Ecosystem.prototype.createElement = () => {
</section> </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"; "use strict";
// P A C K A G E
import Component from "choo/component";
// V A R I A B L E // V A R I A B L E
const links = [ // TODO: Update images const links = [ // TODO: Update images
@ -45,13 +39,7 @@ const links = [ // TODO: Update images
} }
]; ];
export default function () {
// P R O G R A M
FeaturedLinks.prototype = Object.create(Component.prototype);
FeaturedLinks.prototype.createElement = () => {
const renderedLinks = []; const renderedLinks = [];
let imageLink = ""; 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) { function returnLinkTemplate(url, title, image) {
return ` return `
<li class="feature-link"> <li class="feature-link">

View file

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