diff --git a/htdocs/assets/js/floatingbar-config.js b/htdocs/assets/js/floatingbar-config.js index 96d174f..520bf91 100644 --- a/htdocs/assets/js/floatingbar-config.js +++ b/htdocs/assets/js/floatingbar-config.js @@ -100,7 +100,7 @@ function perform_search(searchInput, searchDef, searchRes) { dataType: 'json', data: { keyword: searchString }, success: function(response) { - console.log(response); + inject_search_results(response); }, error: function(error) { console.error('error:', error); @@ -118,6 +118,32 @@ function fallback_search(searchDef, searchRes) { searchRes.classList.add("hidden"); } +function inject_search_results (results) { + searchRes.innerHTML = `
SEARCH RESULTS
`; + + results.forEach(function(result) { + let resultDiv = document.createElement("div"); + resultDiv.className = "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"; + resultDiv.setAttribute("onclick", "location.href='" + result.link + "'"); + + resultDiv.innerHTML = ` + + ${result.name.charAt(0).toUpperCase()} + +${result.description.slice(0, 35) + '...'}
+ + + + ${'#' + result.tag} + + + `; + + searchRes.appendChild(resultDiv); + }); +} + searchInput.addEventListener('input', function() { if (searchInput.value != "") { perform_search(searchInput, searchDef, searchRes); diff --git a/htdocs/assets/style.css b/htdocs/assets/style.css index 53df7cb..dd76133 100644 --- a/htdocs/assets/style.css +++ b/htdocs/assets/style.css @@ -522,8 +522,38 @@ video { --tw-backdrop-sepia: ; } -.static { - position: static; +.container { + width: 100%; +} + +@media (min-width: 640px) { + .container { + max-width: 640px; + } +} + +@media (min-width: 768px) { + .container { + max-width: 768px; + } +} + +@media (min-width: 1024px) { + .container { + max-width: 1024px; + } +} + +@media (min-width: 1280px) { + .container { + max-width: 1280px; + } +} + +@media (min-width: 1536px) { + .container { + max-width: 1536px; + } } .fixed { @@ -998,10 +1028,6 @@ video { cursor: pointer; } -.resize { - resize: both; -} - .flex-col { flex-direction: column; }