import type { ComponentType } from 'react'; import { Link } from 'react-router-dom'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; import { ProjectCard } from '../NewProjectCard/NewProjectCard'; import type { IProjectCard } from 'interfaces/project'; import loadingData from './loadingData'; import { TablePlaceholder } from 'component/common/Table'; import { styled, Typography } from '@mui/material'; const StyledGridContainer = styled('div')(({ theme }) => ({ display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(280px, 1fr))', gap: theme.spacing(2), })); const StyledCardLink = styled(Link)(({ theme }) => ({ color: 'inherit', textDecoration: 'none', border: 'none', padding: '0', background: 'transparent', fontFamily: theme.typography.fontFamily, pointer: 'cursor', })); type ProjectGroupProps = { sectionTitle?: string; projects: T[]; loading: boolean; searchValue: string; placeholder?: string; ProjectCardComponent?: ComponentType; link?: boolean; }; export const ProjectGroup = ({ sectionTitle, projects, loading, searchValue, placeholder = 'No projects available.', ProjectCardComponent = ProjectCard, link = true, }: ProjectGroupProps) => { return (
({ marginBottom: theme.spacing(2) })} > {sectionTitle} } /> 0} show={ No projects found matching “ {searchValue} ” } elseShow={ {placeholder} } /> } elseShow={ ( <> {loadingData.map( (project: IProjectCard) => ( {}} key={project.id} name={project.name} id={project.id} mode={project.mode} memberCount={2} health={95} featureCount={4} /> ), )} )} elseShow={() => ( <> {projects.map((project: T) => link ? ( {}} {...project} /> ) : ( {}} {...project} /> ), )} )} /> } />
); };