import { Fragment } from 'react'; import { AiOutlineBook } from 'react-icons/ai'; import { SanitizedPublication } from '../../interfaces/sanitized-config'; import { skeleton } from '../../utils'; const PublicationCard = ({ publications, loading, }: { publications: SanitizedPublication[]; loading: boolean; }) => { const renderSkeleton = () => { const array = []; for (let index = 0; index < publications.length; index++) { array.push(

{skeleton({ widthCls: 'w-32', heightCls: 'h-8', className: 'mb-2 mx-auto', })}

{skeleton({ widthCls: 'w-20', heightCls: 'h-4', className: 'mb-2 mx-auto', })}
{skeleton({ widthCls: 'w-20', heightCls: 'h-4', className: 'mb-2 mx-auto', })}
{skeleton({ widthCls: 'w-full', heightCls: 'h-4', className: 'mb-2 mx-auto', })}
{skeleton({ widthCls: 'w-full', heightCls: 'h-4', className: 'mb-2 mx-auto', })}
{skeleton({ widthCls: 'w-full', heightCls: 'h-4', className: 'mb-2 mx-auto', })}
, ); } return array; }; const renderPublications = () => { return publications.map((item, index) => (

{item.title}

{item.conferenceName && (

{item.conferenceName}

)} {item.journalName && (

{item.journalName}

)} {item.authors && (

Author: {item.authors}

)} {item.description && (

{item.description}

)}
)); }; return (
{loading ? ( skeleton({ widthCls: 'w-12', heightCls: 'h-12', className: 'rounded-xl', }) ) : (
)}

{loading ? skeleton({ widthCls: 'w-40', heightCls: 'h-8' }) : 'Publications'}

{loading ? skeleton({ widthCls: 'w-32', heightCls: 'h-4' }) : `Showcasing ${publications.length} publications`}
{loading ? renderSkeleton() : renderPublications()}
); }; export default PublicationCard;