framework/js/lib/components/GroupBadge.js
2016-03-29 22:08:44 +09:00

17 lines
460 B
JavaScript

import Badge from 'flarum/components/Badge';
export default class GroupBadge extends Badge {
static initProps(props) {
super.initProps(props);
if (props.group) {
props.icon = props.group.icon();
props.style = {backgroundColor: props.group.color()};
props.label = typeof props.label === 'undefined' ? props.group.nameSingular() : props.label;
props.type = 'group--' + props.group.id();
delete props.group;
}
}
}