UNPKG

@replyke/ui-core-react-js

Version:

Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.

24 lines 867 B
import { jsx as _jsx } from "react/jsx-runtime"; import { resetImg } from "../constants/reset-styles"; import { getUserAvatar } from "../helpers"; function UserAvatar({ user, size = 32, borderRadius, }) { if (!user) return null; return (_jsx("div", { style: { overflow: "hidden", width: size, height: size, borderRadius: borderRadius || size, borderWidth: 1, borderColor: "#E6E6E6", display: "inline-block", flexShrink: 0, }, children: _jsx("img", { src: user.avatar ?? getUserAvatar(user.id), alt: user.name || user.id, style: { ...resetImg, width: "100%", height: "100%", objectFit: "cover", } }) })); } export default UserAvatar; //# sourceMappingURL=UserAvatar.js.map