mirror of
https://github.com/flarum/framework.git
synced 2025-05-24 23:59:57 +08:00
Replace Ember app with Mithril app
This commit is contained in:
17
js/lib/components/nav-item.js
Normal file
17
js/lib/components/nav-item.js
Normal file
@ -0,0 +1,17 @@
|
||||
import Component from 'flarum/component'
|
||||
import icon from 'flarum/helpers/icon'
|
||||
|
||||
export default class NavItem extends Component {
|
||||
view() {
|
||||
var active = NavItem.active(this.props);
|
||||
return m('li'+(active ? '.active' : ''), m('a', {href: this.props.href, config: m.route}, [
|
||||
icon(this.props.icon),
|
||||
this.props.label, ' ',
|
||||
m('span.count', this.props.badge)
|
||||
]))
|
||||
}
|
||||
|
||||
static active(props) {
|
||||
return typeof props.active !== 'undefined' ? props.active : m.route() === props.href;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user