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
17 changes: 17 additions & 0 deletions src/components/ProjectList.astro
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const allTags = [...new Set(projectList.flatMap(project => project.tags || []))]
/>
))}
</section>
<p id="no-results" class="no-results" hidden>No matching projects found.</p>

<script>
// Get all projects data from the server-rendered content
Expand Down Expand Up @@ -67,6 +68,7 @@ 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 noResults = document.getElementById('no-results');

// Filter projects function
function filterProjects() {
Expand Down Expand Up @@ -98,6 +100,10 @@ const allTags = [...new Set(projectList.flatMap(project => project.tags || []))]
const isVisible = filteredProjects.includes(project);
project.element.style.display = isVisible ? 'block' : 'none';
});

if (noResults) {
noResults.hidden = filteredProjects.length > 0;
}
}

// Event listeners
Expand Down Expand Up @@ -185,6 +191,17 @@ const allTags = [...new Set(projectList.flatMap(project => project.tags || []))]
break-inside: avoid;
}

.no-results {
color: rgba(255, 255, 255, 0.8);
font-size: 1rem;
margin: 1rem auto 3rem;
text-align: center;
}

.no-results[hidden] {
display: none;
}


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