UNPKG

@primer/react-brand

Version:

Primer Brand is a GitHub's design system for creating React-based marketing websites and digital experiences.

35 lines (34 loc) 1.03 kB
import e from "../node_modules/clsx/dist/clsx.js"; import t from "./Avatar.module.js"; import { forwardRef as n, useMemo as r } from "react"; import { jsx as i } from "react/jsx-runtime"; //#region src/Avatar/Avatar.tsx var a = [ 32, 40, 48, 64, 80 ], o = ["circle", "square"], s = { root: "Avatar", get image() { return `${this.root}__image`; } }, c = n(({ alt: n, className: c, size: l = a[1], shape: u = o[0], "data-testid": d, src: f, ...p }, m) => { let h = r(() => typeof l == "number" ? t[`Avatar--size-${l}`] : Object.keys(l).map((e) => t[`Avatar-${e}--size-${l[e]}`]).join(" "), [l]); return /* @__PURE__ */ i("span", { ref: m, className: e(t.Avatar, h, t[`Avatar--shape-${u}`], c), "data-testid": d || s.root, children: /* @__PURE__ */ i("img", { className: e(t.Avatar__image), src: f, alt: n, "data-testid": s.image, ...p }) }); }), l = Object.assign(c, { testIds: s }); //#endregion export { l as Avatar, o as AvatarShapes, a as AvatarSizes }; //# sourceMappingURL=Avatar.js.map