mirror of
https://github.com/flarum/framework.git
synced 2024-12-05 00:43:39 +08:00
17 lines
470 B
JavaScript
17 lines
470 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.nameSingular();
|
|
|
|
delete props.group;
|
|
}
|
|
}
|
|
}
|