UNPKG

@claromentis/design-system

Version:

Claromentis Design System Component Library

72 lines (71 loc) 1.84 kB
import { h } from '@stencil/core'; import { lightOrDark } from '../../utils/utils'; /** * @slot - Allows badge content to be added */ export class Badge { constructor() { this.styleclass = "badge badge-primary"; this.colour = null; } render() { if (this.colour) { return (h("span", { class: `${this.styleclass} ` + `${lightOrDark(this.colour)}`, style: { backgroundColor: `${this.colour}` } }, h("slot", null))); } else { return (h("span", { class: this.styleclass }, h("slot", null))); } } static get is() { return "cla-badge"; } static get encapsulation() { return "shadow"; } static get originalStyleUrls() { return { "$": ["cla-badge.scss"] }; } static get styleUrls() { return { "$": ["cla-badge.css"] }; } static get properties() { return { "styleclass": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": false, "docs": { "tags": [], "text": "The bootstrap styling of the badge i.e. badge badge-primary badge-pill etc" }, "attribute": "styleclass", "reflect": false, "defaultValue": "\"badge badge-primary\"" }, "colour": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": false, "docs": { "tags": [], "text": "The background colour of the badge (optional)" }, "attribute": "colour", "reflect": false, "defaultValue": "null" } }; } }