1
1
mirror of https://github.com/neosubhamoy/neosubhamoy-portfolio.git synced 2025-12-19 23:59:35 +05:30

(feat): added no results found message

This commit is contained in:
2023-11-17 22:08:39 +05:30
parent 9bd71fd132
commit 02834eb5f6
4 changed files with 25 additions and 7 deletions

View File

@@ -70,16 +70,16 @@
</div>
<div id="searchresults" class="searchresults w-full flex-col justify-start px-2 mt-1 hidden">
<p class="text-xs text-accent_three mt-3 mb-2 mx-1">SEARCH RESULTS</p>
<div class="group resultitem w-full flex justify-between items-center my-1 p-1 cursor-pointer hover:bg-bg_third transition transform duration-200 rounded-lg" onclick="location.href='<?php echo $basePath ?>'">
<div class="group resultitem w-full flex justify-between items-center my-1 p-1 cursor-pointer hover:bg-bg_third transition transform duration-200 rounded-lg" onclick="location.href='#'">
<span class="flex items-center">
<span class="mx-1 px-[0.65rem] py-1 rounded border-[1px] border-accent_secondary_transparent">P</span>
<span class="mx-1 px-[0.65rem] py-1 rounded border-[1px] border-accent_secondary_transparent">TITLE LETTER</span>
<span class="flex flex-col">
<h6 class="mx-1">ProURL</h6>
<p class="mx-1 text-xs text-accent_three">All in one link shortener and management tool webapp</p>
<h6 class="mx-1">TITLE</h6>
<p class="mx-1 text-xs text-accent_three">DESCRIPTION</p>
</span>
</span>
<span class="flex items-center mr-1">
<span class="px-[1rem] py-[0.05rem] mx-1 text-xs bg-accent_four text-bg_secondary rounded-full group-hover:hidden">#project</span>
<span class="px-[1rem] py-[0.05rem] mx-1 text-xs bg-accent_four text-bg_secondary rounded-full group-hover:hidden">#TAG</span>
<i class="fa-solid fa-chevron-right text-accent_three mx-2 hidden group-hover:block"></i>
</span>
</div>

View File

@@ -100,7 +100,13 @@ function perform_search(searchInput, searchDef, searchRes) {
dataType: 'json',
data: { keyword: searchString },
success: function(response) {
inject_search_results(response);
console.log(response);
if(response.results && response.results === "none") {
inject_no_results(response);
}
else {
inject_search_results(response);
}
},
error: function(error) {
console.error('error:', error);
@@ -144,6 +150,10 @@ function inject_search_results (results) {
});
}
function inject_no_results(results) {
searchRes.innerHTML = `<div class="resultitem w-full h-[59vh] flex flex-col justify-center items-center"><p class="text-xl text-accent_three">${results.message}</p</div>`;
}
searchInput.addEventListener('input', function() {
if (searchInput.value != "") {
perform_search(searchInput, searchDef, searchRes);

View File

@@ -936,6 +936,14 @@ video {
height: 100vh;
}
.h-\[57vh\] {
height: 57vh;
}
.h-\[59vh\] {
height: 59vh;
}
.w-0 {
width: 0px;
}