mirror of
https://github.com/flarum/framework.git
synced 2025-05-23 23:29:57 +08:00
Replace Ember app with Mithril app
This commit is contained in:
21
js/lib/components/action-button.js
Normal file
21
js/lib/components/action-button.js
Normal file
@ -0,0 +1,21 @@
|
||||
import Component from 'flarum/component';
|
||||
import icon from 'flarum/helpers/icon';
|
||||
|
||||
export default class ActionButton extends Component {
|
||||
view() {
|
||||
var attrs = {};
|
||||
for (var i in this.props) { attrs[i] = this.props[i]; }
|
||||
|
||||
var iconName = attrs.icon;
|
||||
delete attrs.icon;
|
||||
|
||||
var label = attrs.label;
|
||||
delete attrs.label;
|
||||
|
||||
attrs.href = attrs.href || 'javascript:;';
|
||||
return m('a', attrs, [
|
||||
iconName ? icon(iconName+' icon-glyph') : '',
|
||||
m('span.label', label)
|
||||
]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user