Skip to content

Instantly share code, notes, and snippets.

@philipusis
Created August 8, 2016 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philipusis/9765343c6da17db2c20b4bc280ed5695 to your computer and use it in GitHub Desktop.
Save philipusis/9765343c6da17db2c20b4bc280ed5695 to your computer and use it in GitHub Desktop.
block('header-menu')(
content()(function() {
return this.ctx.items.map(function(item) {
return {
elem: 'menu-item',
attrs: { href: item.url },
content: item.icon ?
[
{
elem: 'menu-item-icon',
icon: item.icon
},
{
elem: 'menu-item-text',
content: item.text
}
]
: item.text
}
});
}),
elem('menu-item')(
tag()('a')
),
elem('menu-item-icon')(
tag()('i'),
cls()(function() {
switch(this.ctx.icon) {
case 'geo':
return 'fa fa-globe'
}
})
),
elem('menu-item-text')(
tag()('span')
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment