@cerberus-design/react
Version:
The Cerberus Design React component library.
27 lines (24 loc) • 1.27 kB
JavaScript
'use client';
import { jsx, Fragment } from 'react/jsx-runtime';
import { useRef } from 'react';
import { useCerberusContext } from '../../context/cerberus.js';
import { Avatar } from '../avatar/avatar.js';
function MatchAvatar(props) {
const { palette = "page" } = props;
const { icons } = useCerberusContext();
const {
infoNotification: InfoIcon,
successNotification: SuccessIcon,
warningNotification: WarningIcon,
dangerNotification: DangerIcon
} = icons;
const elRef = useRef({
page: /* @__PURE__ */ jsx(Avatar, { gradient: "charon-light", fallback: /* @__PURE__ */ jsx(InfoIcon, {}), size: "sm" }),
info: /* @__PURE__ */ jsx(Avatar, { gradient: "amphiaraus-dark", fallback: /* @__PURE__ */ jsx(InfoIcon, {}), size: "sm" }),
success: /* @__PURE__ */ jsx(Avatar, { gradient: "thanatos-dark", fallback: /* @__PURE__ */ jsx(SuccessIcon, {}), size: "sm" }),
warning: /* @__PURE__ */ jsx(Avatar, { gradient: "asphodel-light", fallback: /* @__PURE__ */ jsx(WarningIcon, {}), size: "sm" }),
danger: /* @__PURE__ */ jsx(Avatar, { gradient: "hades-light", fallback: /* @__PURE__ */ jsx(DangerIcon, {}), size: "sm" })
});
return /* @__PURE__ */ jsx(Fragment, { children: elRef.current[palette] });
}
export { MatchAvatar };