Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
breadcrumb
var m = require('mithril');
var _ = require('lodash');
var breadcrumb = {};
breadcrumb.array = [];
breadcrumb.set = function (array) {
breadcrumb.array = array;
m.redraw();
}
breadcrumb.view = function () {
return m('.breadcrumb', [
_.map(breadcrumb.array, function (b, i) {
return m('.breadcrumb', [
m('i.material-icons', 'chevron_right'),
m('a.breadcrumb-link', {
href: b.url,
config: m.route
}, [
b.icon ? m('i.material-icons', b.icon) : '',
b.text ? m('p', b.text) : ''
]),
i < breadcrumb.array.length - 1 ?
m('i.material-icons', 'chevron_right') : ''
])
})
])
}
module.exports = breadcrumb;
Layout
-> Navbar -> Breadcrumb
-> Page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.