Fixes and linting

This commit is contained in:
ポール ウェッブ 2018-09-26 11:42:41 -05:00
parent 303caa19a4
commit 430d514e7f
7 changed files with 69 additions and 29 deletions

View file

@ -9,10 +9,7 @@
], ],
"parserOptions": { "parserOptions": {
"ecmaVersion": 2017, "ecmaVersion": 2017,
"sourceType": "module", "sourceType": "module"
"ecmaFeatures": {
"experimentalObjectRestSpread": true
}
}, },
"rules": { "rules": {
"indent": ["error", 2, { "SwitchCase": 1 }], "indent": ["error", 2, { "SwitchCase": 1 }],

View file

@ -1,5 +1,7 @@
"use strict"; "use strict";
// 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");
@ -10,6 +12,10 @@ 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");
// E X P O R T
export default function () { export default function () {
return ` return `
<section class="ecosystem"> <section class="ecosystem">
@ -30,4 +36,4 @@ export default function () {
</aside> </aside>
</section> </section>
`; `;
}; }

View file

@ -1,5 +1,7 @@
"use strict"; "use strict";
// 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
@ -39,6 +41,10 @@ const links = [ // TODO: Update images
} }
]; ];
// E X P O R T
export default function () { export default function () {
const renderedLinks = []; const renderedLinks = [];
let imageLink = ""; let imageLink = "";
@ -51,7 +57,11 @@ export default function () {
return ` return `
<ul class="feature-links">${renderedLinks.join("")}</ul> <ul class="feature-links">${renderedLinks.join("")}</ul>
`; `;
}; }
// H E L P E R
function returnLinkTemplate(url, title, image) { function returnLinkTemplate(url, title, image) {
return ` return `

View file

@ -1,7 +1,28 @@
"use strict"; "use strict";
// P A C K A G E
import html from "choo/html"; import html from "choo/html";
// E X P O R T
export default (links) => {
const renderedLinks = links.map((link) => returnLinkTemplate(link.title, link.description, link.destination, link.label));
return html`
<ul class="link-grid">
${renderedLinks}
</ul>
`;
};
// H E L P E R
function returnLinkTemplate(title, description, destination, label) { function returnLinkTemplate(title, description, destination, label) {
return ` return `
<li class="link-grid__link"> <li class="link-grid__link">
@ -11,12 +32,3 @@ function returnLinkTemplate(title, description, destination, label) {
</li> </li>
`; `;
} }
export default (links) => {
const renderedLinks = links.map((link) => returnLinkTemplate(link.title, link.description, link.destination, link.label));
return html`
<ul class="link-grid">
${renderedLinks}
</ul>
`;
}

View file

@ -5,11 +5,30 @@
// P A C K A G E // P A C K A G E
import html from "choo/html"; import html from "choo/html";
// V A R I A B L E
import linkGrid from "../components/link-grid"; import linkGrid from "../components/link-grid";
// E X P O R T // E X P O R T
const featureLinks = linkGrid([
{
description: "Learn how LBRY works with 3 easy examples",
destination: "/tour",
label: "Take the Tour",
title: "New to LBRY?"
},
{
description: "Help make LBRY better!",
destination: "/contribute",
label: "Explore our repos",
title: "Want to contribute?"
}
]);
module.exports = exports = () => html` module.exports = exports = () => html`
<div> <div>
<section class="hero"> <section class="hero">
@ -22,17 +41,7 @@ module.exports = exports = () => html`
</section> </section>
<section class="features"> <section class="features">
${linkGrid([{ ${featureLinks}
title: "New to LBRY?",
description: "Learn how LBRY works with 3 easy examples",
destination: "/tour",
label: "Take the Tour"
}, {
title: "New to LBRY?",
description: "Learn how LBRY works with 3 easy examples",
destination: "/tour",
label: "Take the Tour"
}])}
</section> </section>
<section class="intro"> <section class="intro">

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`));
const markdownHtml = filename === "glossary-toc" ? partialFunction : partialFunction.default(); // kill special case const markdownHtml = filename === "glossary-toc" ? partialFunction : partialFunction.default(); // kill special case
markdownBody = markdownBody.replace(partial, '</div>' + markdownHtml + '<div class="page__markup">'); markdownBody = markdownBody.replace(partial, `</div>${markdownHtml}<div class="page__markup">`);
} }
} }

View file

@ -18,7 +18,7 @@
"decamelize": "^2.0.0", "decamelize": "^2.0.0",
"dedent": "^0.7.0", "dedent": "^0.7.0",
"dotenv": "^6.0.0", "dotenv": "^6.0.0",
"fastify": "^1.12.0", "fastify": "^1.12.1",
"fastify-compress": "^0.7.0", "fastify-compress": "^0.7.0",
"fastify-helmet": "^2.1.0", "fastify-helmet": "^2.1.0",
"fastify-plugin": "^1.2.1", "fastify-plugin": "^1.2.1",
@ -59,6 +59,7 @@
"@babel/plugin-syntax-import-meta": "7.0.0", "@babel/plugin-syntax-import-meta": "7.0.0",
"@babel/preset-env": "^7.1.0", "@babel/preset-env": "^7.1.0",
"@babel/register": "^7.0.0", "@babel/register": "^7.0.0",
"husky": "^1.0.0",
"nodemon": "^1.18.4", "nodemon": "^1.18.4",
"npm-run-all": "^4.1.3", "npm-run-all": "^4.1.3",
"sass": "^1.14.0", "sass": "^1.14.0",
@ -69,6 +70,11 @@
"engines": { "engines": {
"node": "10.2.x" "node": "10.2.x"
}, },
"husky": {
"hooks": {
"pre-commit": "npm run test:lint"
}
},
"main": "server.js", "main": "server.js",
"name": "lbry.tech", "name": "lbry.tech",
"private": true, "private": true,