lbry.tech/views/partials/navigation.js
ポール ウェッブ c8926b8fa1 Refactoring and cleanup
2018-07-13 16:58:24 -05:00

54 lines
1.1 KiB
JavaScript
Executable file

"use strict";
// P A C K A G E
const html = require("choo-async/html");
// V A R I A B L E
const navigationItems = [
{
url: "/overview",
name: "Overview",
title: "LBRY overview"
},
{
url: "/resources",
name: "Resources",
title: "View LBRY resources"
},
{
url: "/contribute",
name: "Contribute",
title: "Contribute to LBRY"
},
{
url: "/build",
name: "Build",
title: "View LBRY resources"
},
{
url: "/community",
name: "Community",
title: "Interact with LBRY"
}
];
// E X P O R T
module.exports = exports = state => {
const renderedNavigationItems = navigationItems.map(navigationItem => `<a class="navigation__item${state.href === navigationItem.url ? " active" : ""}" href="${navigationItem.url}" title="${navigationItem.title}">${navigationItem.name}</a>`);
return html`
<nav class="navigation">
<div class="inner-wrap">
<a class="navigation__item logo" href="/" title="LBRY homepage">Home</a>
${renderedNavigationItems}
</div>
</nav>
`;
};