mirror of
https://github.com/NohamR/gitprofile.git
synced 2026-05-25 12:27:17 +00:00
70 lines
2.1 KiB
JavaScript
70 lines
2.1 KiB
JavaScript
import PropTypes from 'prop-types';
|
|
import { fallbackImage, skeleton } from '../../helpers/utils';
|
|
import LazyImage from '../lazy-image';
|
|
|
|
const AvatarCard = ({ profile, loading, avatarRing }) => {
|
|
return (
|
|
<div className="card shadow-lg compact bg-base-100">
|
|
<div className="grid place-items-center py-8">
|
|
{loading || !profile ? (
|
|
<div className="avatar opacity-90">
|
|
<div className="mb-8 rounded-full w-32 h-32">
|
|
{skeleton({
|
|
width: 'w-full',
|
|
height: 'h-full',
|
|
shape: '',
|
|
})}
|
|
</div>
|
|
</div>
|
|
) : (
|
|
<div className="avatar opacity-90">
|
|
<div
|
|
className={`mb-8 rounded-full w-32 h-32 ${
|
|
avatarRing
|
|
? 'ring ring-primary ring-offset-base-100 ring-offset-2'
|
|
: ''
|
|
}`}
|
|
>
|
|
{
|
|
<LazyImage
|
|
src={profile.avatar ? profile.avatar : fallbackImage}
|
|
alt={profile.name}
|
|
placeholder={skeleton({
|
|
width: 'w-full',
|
|
height: 'h-full',
|
|
shape: '',
|
|
})}
|
|
/>
|
|
}
|
|
</div>
|
|
</div>
|
|
)}
|
|
<div className="text-center mx-auto px-8">
|
|
<h5 className="font-bold text-2xl">
|
|
{loading || !profile ? (
|
|
skeleton({ width: 'w-48', height: 'h-8' })
|
|
) : (
|
|
<span className="text-base-content opacity-70">
|
|
{profile.name}
|
|
</span>
|
|
)}
|
|
</h5>
|
|
<div className="mt-3 text-base-content text-opacity-60 font-mono">
|
|
{loading || !profile
|
|
? skeleton({ width: 'w-48', height: 'h-5' })
|
|
: profile.bio}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
AvatarCard.propTypes = {
|
|
profile: PropTypes.object,
|
|
loading: PropTypes.bool.isRequired,
|
|
avatarRing: PropTypes.bool.isRequired,
|
|
};
|
|
|
|
export default AvatarCard;
|