UNPKG

@public-ui/components

Version:

Contains all web components that belong to KoliBri - The accessible HTML-Standard.

18 lines (17 loc) 917 B
/*! * KoliBri - The accessible HTML-Standard */ import { h } from "@stencil/core"; import { translate } from "../../../i18n"; import { bem } from "../../../schema/bem-registry"; const BEM_BLOCK_AVATAR = 'kol-avatar'; const BEM_CLASS_AVATAR__IMAGE = bem(BEM_BLOCK_AVATAR, 'image'); const BEM_CLASS_AVATAR__INITIALS = bem(BEM_BLOCK_AVATAR, 'initials'); export const AvatarFC = (props) => { const { color, initials, label, src } = props; return (h("div", { "aria-label": translate('kol-avatar-alt', { placeholders: { name: label } }), class: "kol-avatar", role: "img", style: { backgroundColor: color.backgroundColor, color: color.foregroundColor, } }, src ? (h("img", { alt: "", "aria-hidden": "true", class: BEM_CLASS_AVATAR__IMAGE, src: src })) : (h("span", { "aria-hidden": "true", class: BEM_CLASS_AVATAR__INITIALS }, initials)))); }; //# sourceMappingURL=component.js.map