UNPKG

@cerberus-design/react

Version:

The Cerberus Design React component library.

22 lines (19 loc) 657 B
import { jsx, jsxs, Fragment } from 'react/jsx-runtime'; import { Show } from '../show/show.js'; import { AvatarParts } from './parts.js'; function Avatar(props) { const { alt, src, fallback, children, ...rootProps } = props; const imgProps = { alt, src }; return /* @__PURE__ */ jsx(AvatarParts.Root, { ...rootProps, children: /* @__PURE__ */ jsx( Show, { when: children, fallback: /* @__PURE__ */ jsxs(Fragment, { children: [ /* @__PURE__ */ jsx(AvatarParts.Fallback, { children: fallback }), /* @__PURE__ */ jsx(AvatarParts.Image, { ...imgProps }) ] }), children } ) }); } export { Avatar };