Skip to content

Instantly share code, notes, and snippets.

@philipusis
Created August 8, 2016 13:51
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/98ef774c2c2001e85cb04a6fffbf178f to your computer and use it in GitHub Desktop.
Save philipusis/98ef774c2c2001e85cb04a6fffbf178f to your computer and use it in GitHub Desktop.
block('header-menu')(
content()(function() {
return this.ctx.items.map(function(item) {
return {
block: 'link',
mix: [{block: 'header-menu', elem: 'menu-item'}],
url: item.url,
content: item.icon ?
[
{
elem: 'menu-item-icon',
mix: [{block: 'header-menu', elem: 'menu-item-icon'}],
icon: item.icon
},
{
elem: 'menu-item-text',
mix: [{block: 'header-menu', elem: 'menu-item-text'}],
content: item.text
}
]
: item.text
}
});
}),
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