search nw displays the search results.
other section are being hidden in the case of a search and vice versa. a 'nothing found' div was implemented
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { searchBarTimeout } from "./main.js"
|
||||
import {searchBarTimeout, searchSection} from "./main.js"
|
||||
import Dataset from "./dataset.js"
|
||||
|
||||
export function fetchQuery(fetchString) {
|
||||
clearTimeout(searchBarTimeout);
|
||||
@@ -11,4 +12,17 @@ export function fetchQuery(fetchString) {
|
||||
|
||||
function parseContent(content) {
|
||||
//TODO: method for parsing query results
|
||||
console.log(content);
|
||||
if (content.length === 0) {
|
||||
searchSection.querySelector("#nothing-found ").classList.remove("hidden");
|
||||
} else {
|
||||
searchSection.querySelector("#nothing-found").classList.add("hidden");
|
||||
const datasets = content.map(dataset => new Dataset(dataset));
|
||||
console.log(datasets);
|
||||
Array.from(searchSection.querySelectorAll(".datasets .dataset")).forEach(e => e.remove());
|
||||
for (const dataset of datasets) {
|
||||
searchSection.querySelector(".datasets").appendChild(dataset.createDatasetHTMLElement());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user