diff --git a/src/components/avatar-card/index.jsx b/src/components/avatar-card/index.jsx new file mode 100644 index 0000000..f3f00fb --- /dev/null +++ b/src/components/avatar-card/index.jsx @@ -0,0 +1,65 @@ +import PropTypes from 'prop-types'; +import { useContext } from 'react'; +import { LoadingContext } from '../../contexts/LoadingContext'; +import { skeleton } from '../../helpers/utils'; +import LazyImage from '../lazy-image'; + +const AvatarCard = (props) => { + const [loading] = useContext(LoadingContext); + + return ( +
+
+ {loading || !props.profile ? ( +
+
+ {skeleton({ + width: 'w-full', + height: 'h-full', + shape: '', + })} +
+
+ ) : ( +
+
+ { + + } +
+
+ )} +
+
+ {loading || !props.profile ? ( + skeleton({ width: 'w-48', height: 'h-8' }) + ) : ( + {props.profile.name} + )} +
+
+ {loading || !props.profile + ? skeleton({ width: 'w-48', height: 'h-5' }) + : props.profile.bio} +
+
+
+
+ ); +}; + +AvatarCard.propTypes = { + profile: PropTypes.object, +}; + +export default AvatarCard;