UNPKG

@payfit/unity-components

Version:

33 lines (32 loc) 1.05 kB
import { useAvatarContext as e } from "../Avatar.context.js"; import * as t from "react"; import { jsx as n } from "react/jsx-runtime"; import { IconSprite as r } from "@payfit/unity-icons"; import * as i from "@payfit/unity-themes/tokens/common/spacings.json"; //#region src/components/avatar/parts/AvatarIcon.tsx var a = (e) => parseInt(e.replace("px", "").trim(), 10), o = { xl: a(i.spacing[500].$value), lg: a(i.spacing[300].$value), md: a(i.spacing[250].$value), sm: a(i.spacing[200].$value), xs: a(i.spacing[150].$value), default: a(i.spacing[250].$value) }, s = t.forwardRef(({ src: t, alt: i = "", className: a }, s) => { let { size: c } = e(), l = o[c]; return /* @__PURE__ */ n("div", { "data-dd-privacy": "allow", ref: s, role: "img", className: `uy:flex uy:items-center uy:justify-center uy:w-full uy:h-full ${a || ""}`, "aria-label": i, children: /* @__PURE__ */ n(r, { src: t, width: l, height: l, fill: "currentColor" }) }); }); s.displayName = "AvatarIcon"; //#endregion export { s as AvatarIcon };