Skip to content

Instantly share code, notes, and snippets.

@philipusis
Last active August 8, 2016 12:47
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/649e8d80931a84e0f57dfae74b9101c1 to your computer and use it in GitHub Desktop.
Save philipusis/649e8d80931a84e0f57dfae74b9101c1 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',
url: item.url,
pseudo: !item.url,
mix: [{ block: 'link' }],
js: true,
attrs: {
'data-bem': { 'header-menu__menu-item': { url: item.url } }
},
content: item.icon ?
[
{
elem: 'menu-item-icon',
icon: item.icon
},
{
elem: 'menu-item-text',
content: item.text
}
]
: item.text
}
});
}),
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment