import { Node } from '../../../node.js';
import { Badge } from '../../../../component/components/badge.js';

class BadgeLeafDirective extends Node {
  constructor (data) {
    super(data);
    this.badge = new Badge({...this.data.properties, ...this.data.attributes});
  }

  async render () {
    const data = { label: await this.renderChildren() };
    return this.badge.render(data);
  }
}

BadgeLeafDirective.NAME = 'fr-badge';

export { BadgeLeafDirective };
