@datalayer/core
Version:
**Datalayer Core**
33 lines (32 loc) • 1.12 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
/*
* Copyright (c) 2023-2025 Datalayer, Inc.
* Distributed under the terms of the Modified BSD License.
*/
import { Avatar, Link } from '@primer/react';
import { Box } from "@datalayer/primer-addons";
import { AvatarSkeleton } from '../../components/display';
import { getAvatarURL } from '../../utils';
const Profile = (props) => {
const { user, size, onClick } = props;
return (_jsx(Box, { style: { width: size }, children: _jsx(Avatar
// square
, {
// square
src: getAvatarURL(user?.avatarUrl), size: size, onClick: onClick }) }));
};
export const UserProfileAvatar = (props) => {
const { onClick, user, size } = props;
return (user ?
onClick
?
_jsx(Link, { href: "javascript: return false;", onClick: onClick, children: _jsx(Profile, { ...props }) })
:
_jsx(Profile, { ...props })
:
_jsx(AvatarSkeleton, { size: size }));
};
UserProfileAvatar.defaultProps = {
size: 100,
};
export default UserProfileAvatar;