import { MdLocationOn, MdMail } from 'react-icons/md'; import { AiFillGithub, AiFillInstagram, AiFillMediumSquare, } from 'react-icons/ai'; import { SiTwitter } from 'react-icons/si'; import { GrLinkedinOption } from 'react-icons/gr'; import { CgDribbble } from 'react-icons/cg'; import { RiPhoneFill } from 'react-icons/ri'; import { Fragment } from 'react'; import { FaBehanceSquare, FaBuilding, FaDev, FaFacebook, FaGlobe, } from 'react-icons/fa'; import PropTypes from 'prop-types'; import { skeleton } from '../../helpers/utils'; const ListItem = ({ icon, title, value, link, skeleton = false }) => { return ( {icon}
{title}
{value}
); }; const Details = ({ profile, loading, social, github }) => { const renderSkeleton = () => { let array = []; for (let index = 0; index < 4; index++) { array.push( ); } return array; }; return (
{loading || !profile ? ( renderSkeleton() ) : ( {profile.location && ( } title="Based in:" value={profile.location} /> )} {profile.company && ( } title="Company:" value={profile.company} /> )} } title="GitHub:" value={github.username} link={`https://github.com/${github.username}`} /> {typeof social.twitter !== 'undefined' && social.twitter && ( } title="Twitter:" value={social.twitter} link={`https://twitter.com/${social.twitter}`} /> )} {typeof social.linkedin !== 'undefined' && social.linkedin && ( } title="LinkedIn:" value={social.linkedin} link={`https://www.linkedin.com/in/${social.linkedin}`} /> )} {typeof social.dribbble !== 'undefined' && social.dribbble && ( } title="Dribbble:" value={social.dribbble} link={`https://dribbble.com/${social.dribbble}`} /> )} {typeof social.behance !== 'undefined' && social.behance && ( } title="Behance:" value={social.behance} link={`https://www.behance.net/${social.behance}`} /> )} {typeof social.facebook !== 'undefined' && social.facebook && ( } title="Facebook:" value={social.facebook} link={`https://www.facebook.com/${social.facebook}`} /> )} {typeof social.instagram !== 'undefined' && social.instagram && ( } title="Instagram:" value={social.instagram} link={`https://www.instagram.com/${social.instagram}`} /> )} {typeof social.medium !== 'undefined' && social.medium && ( } title="Medium:" value={social.medium} link={`https://medium.com/@${social.medium}`} /> )} {typeof social.dev !== 'undefined' && social.dev && ( } title="Dev:" value={social.dev} link={`https://dev.to/${social.dev}`} /> )} {typeof social.website !== 'undefined' && social.website && ( } title="Website:" value={social.website} link={social.website} /> )} {typeof social.phone !== 'undefined' && social.phone && ( } title="Phone:" value={social.phone} link={`tel:${social.phone}`} /> )} {typeof social.email !== 'undefined' && social.email && ( } title="Email:" value={social.email} link={`mailto:${social.email}`} /> )} )}
); }; Details.propTypes = { profile: PropTypes.object, loading: PropTypes.bool.isRequired, social: PropTypes.object.isRequired, github: PropTypes.object.isRequired, }; ListItem.propTypes = { icon: PropTypes.node, title: PropTypes.node, value: PropTypes.node, link: PropTypes.string, skeleton: PropTypes.bool, }; export default Details;