framework/js/lib/components/nav-item.js
Toby Zerner e466dcc626 Significantly improve mobile UX
Most of #137 done.

- Use FastClick to make everything feel more responsive
- Use transforms for animations to make them silky smooth
- Style the drawer the same as the header to keep things simple
- Revert to fixed composer, but allow it to be minimised
- Add a separate notifications page for mobile so it’s easy to go back
- Add indicator to the menu button when there are unread notifications
- Close the drawer when navigating away
- Make dropdowns/modals scrollable
- Many other mobile tweaks and bug fixes

Didn’t take much care to keep CSS clean, due to #103
2015-06-24 11:44:53 +09:30

22 lines
617 B
JavaScript

import Component from 'flarum/component'
import icon from 'flarum/helpers/icon'
export default class NavItem extends Component {
view() {
var active = this.constructor.active(this.props);
return m('li'+(active ? '.active' : ''), m('a.has-icon', {
href: this.props.href,
onclick: this.props.onclick,
config: m.route
}, [
icon(this.props.icon+' icon'),
this.props.label, ' ',
this.props.badge ? m('span.count', this.props.badge) : ''
]))
}
static active(props) {
return typeof props.active !== 'undefined' ? props.active : m.route() === props.href;
}
}