react-together
Version:
A library to seamlessly add real-time multi-user interaction to your React app!
24 lines (23 loc) • 636 B
JavaScript
import { jsx as o } from "react/jsx-runtime";
import { useMemo as e } from "react";
import { getUserColor as l } from "../../utils/colors.js";
import "unique-names-generator";
function u({ isMe: i, senderId: r }) {
const a = e(() => l(r), [r]), s = e(() => {
if (!r)
return "";
const t = r.trim();
return `${t[0]}${t[t.length - 1]}`.toUpperCase();
}, [r]);
return /* @__PURE__ */ o(
"div",
{
className: `rt-avatar ${i ? "isMe" : ""}`,
style: { backgroundColor: a },
children: /* @__PURE__ */ o("label", { className: "rt-initials", children: s })
}
);
}
export {
u as default
};