import { Fragment } from "react"; import { useSelector } from "react-redux"; import { languageColor, skeleton } from "../helpers/utils"; import { AiFillStar, AiOutlineFork } from 'react-icons/ai'; const LIMIT = 8; const Project = () => { const loading = useSelector(state => state.loading); const repo = useSelector(state => state.repo); const renderSkeleton = () => { let array = []; for (let index = 0; index < LIMIT; index++) { array.push((
{skeleton({width: 'w-32', height: 'h-8'})}

{skeleton({width: 'w-full', height: 'h-4', className: 'mb-2'})} {skeleton({width: 'w-full', height: 'h-4'})}

{skeleton({width: 'w-12', height: 'h-4'})} {skeleton({width: 'w-12', height: 'h-4'})}
{skeleton({width: 'w-12', height: 'h-4'})}
)) } return array; } const renderProjects = () => { return repo.slice(0, LIMIT).map((item, index) => (
{item.name}

{item.description}

{item.stargazers_count} {item.forks_count}
{item.language}
)); } return (
  • {loading ? skeleton({width: 'w-28', height: 'h-8'}) : 'Project'}
    { loading ? skeleton({width: 'w-8', height: 'h-8'}) : ( ) }
{(loading || !repo) ? renderSkeleton() : renderProjects()}
) } export default Project;