veza/apps/web/dist_verification/assets/avatar-B2y8ugWJ.js

1 line
1.3 KiB
JavaScript

import{R as w,j as e}from"./vendor-react-BHG7lGYR.js";import{d as r}from"./index-BWcMVITa.js";const u=w.forwardRef(({src:s,alt:l="Avatar",fallback:n,size:d="md",status:a,className:x="",onClick:i},b)=>{const h={xs:"w-6 h-6 text-[10px]",sm:"w-8 h-8 text-xs",md:"w-10 h-10 text-sm",lg:"w-12 h-12 text-base",xl:"w-16 h-16 text-lg","2xl":"w-24 h-24 text-xl","3xl":"w-32 h-32 text-2xl"},c={online:"bg-kodo-lime",offline:"bg-kodo-steel",away:"bg-kodo-gold",idle:"bg-kodo-gold",busy:"bg-kodo-red",dnd:"bg-kodo-red"},m={xs:"w-1.5 h-1.5 border",sm:"w-2 h-2 border",md:"w-2.5 h-2.5 border-2",lg:"w-3 h-3 border-2",xl:"w-4 h-4 border-2","2xl":"w-5 h-5 border-4","3xl":"w-6 h-6 border-4"},g=(o=>{if(!o)return"?";const t=o.trim().split(" ");return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():o.substring(0,2).toUpperCase()})(n||l);return e.jsxs("div",{ref:b,className:r("relative inline-block",x,i?"cursor-pointer":""),onClick:i,children:[e.jsx("div",{className:r(`${h[d]} rounded-full overflow-hidden bg-kodo-graphite border border-kodo-steel flex items-center justify-center relative`),children:s?e.jsx("img",{src:s,alt:l,className:"w-full h-full object-cover"}):e.jsx("span",{className:"font-bold text-kodo-content-dim",children:g})}),a&&e.jsx("span",{className:r("absolute bottom-0 right-0 rounded-full border-kodo-void",c[a],m[d])})]})});u.displayName="Avatar";export{u as A};