Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/components/ProjectList.astro
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ const allTags = [...new Set(projectList.flatMap(project => project.tags || []))]
</div>
</div>

<p id="no-project-results" class="no-project-results" role="status" aria-live="polite" hidden>
No projects match your search.
</p>

<section id="project-list" class="containerLayout">
{projectList.map((item) => (
<ProjectCard
Expand Down Expand Up @@ -67,6 +71,13 @@ const allTags = [...new Set(projectList.flatMap(project => project.tags || []))]
const searchInput = document.getElementById('search');
const tagSelector = document.getElementById('tag-selector');
const projectListContainer = document.getElementById('project-list');
const noResultsMessage = document.getElementById('no-project-results');

const initialSearchValue = new URLSearchParams(window.location.search).get('q')?.trim() || '';
if (initialSearchValue) {
searchValue = initialSearchValue;
searchInput.value = initialSearchValue;
}

// Filter projects function
function filterProjects() {
Expand All @@ -92,6 +103,7 @@ const allTags = [...new Set(projectList.flatMap(project => project.tags || []))]
}

filteredProjects = filtered;
noResultsMessage.hidden = filteredProjects.length > 0;

// Hide/show cards instead of re-rendering
projectList.forEach(project => {
Expand Down Expand Up @@ -185,6 +197,13 @@ const allTags = [...new Set(projectList.flatMap(project => project.tags || []))]
break-inside: avoid;
}

.no-project-results {
color: rgba(255, 255, 255, 0.8);
font-size: 1rem;
margin: 0 auto 2rem;
padding: 0 1rem;
}


@media (max-width: 768px) {
#container {
Expand Down