refactor attempt #146

Merged
kauffj merged 2 commits from link_refactor into master 2018-09-25 17:01:33 +02:00
2 changed files with 2 additions and 29 deletions
Showing only changes of commit f352be308b - Show all commits

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

@ -146,7 +146,7 @@ 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 === "ecosystem") {
const neatPartial = new partialFunction; const neatPartial = new partialFunction;
markdownBody = markdownBody.replace(partial, neatPartial.render()); markdownBody = markdownBody.replace(partial, neatPartial.render());
} }