Skip to content

Commit

Permalink
feat: Add a "No projects found" message when search field no results …
Browse files Browse the repository at this point in the history
…on the Projects page gf-187 (#210)

* feat: add the message gf-187

* feat: add styles to the message gf-187

* fix: fix placeholder styles gf-187

* feat: change placeholder color gf-187
  • Loading branch information
HoroshkoMykhailo authored Sep 6, 2024
1 parent 7fb5001 commit 43bafae
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 16 deletions.
39 changes: 23 additions & 16 deletions apps/frontend/src/pages/projects/projects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const Projects = (): JSX.Element => {
[dispatch],
);

const hasProject = projects.length === EMPTY_LENGTH;
const hasProject = projects.length !== EMPTY_LENGTH;

const {
isOpened: isCreateModalOpen,
Expand Down Expand Up @@ -122,7 +122,7 @@ const Projects = (): JSX.Element => {

const isLoading =
dataStatus === DataStatus.IDLE ||
(dataStatus === DataStatus.PENDING && hasProject);
(dataStatus === DataStatus.PENDING && !hasProject);

return (
<PageLayout>
Expand All @@ -131,20 +131,27 @@ const Projects = (): JSX.Element => {
<Button label="Create New" onClick={handleCreateModalOpen} />
</header>
<ProjectsSearch onChange={handleSearchChange} />
<div className={styles["projects-list"]}>
{isLoading ? (
<Loader />
) : (
projects.map((project) => (
<ProjectCard
key={project.id}
onDelete={handleDeleteClick}
onEdit={handleEditClick}
project={project}
/>
))
)}
</div>
{isLoading ? (
<Loader />
) : (
<div className={styles["projects-list"]}>
{hasProject ? (
projects.map((project) => (
<ProjectCard
key={project.id}
onDelete={handleDeleteClick}
onEdit={handleEditClick}
project={project}
/>
))
) : (
<p className={styles["empty-placeholder"]}>
No projects found matching your search criteria. Please try
different keywords.
</p>
)}
</div>
)}
<Modal
isOpened={isCreateModalOpen}
onClose={handleCreateModalClose}
Expand Down
8 changes: 8 additions & 0 deletions apps/frontend/src/pages/projects/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,11 @@
gap: 12px;
padding: 20px 0;
}

.empty-placeholder {
align-self: center;
font-size: 16px;
font-weight: 400;
line-height: 150%;
color: var(--color-text-secondary);
}

0 comments on commit 43bafae

Please sign in to comment.