import { createElement } from "../../lib/skeleton/index.js"; import { CSS } from "../../helpers/loader.js"; const $tmpl = createElement(`
directory Videos 06/06/2020
edit delete share
`); // a filesystem "thing" is typically either a file or folder which have a lot of behavior builtin. // Probably one day we can rename that to something more clear but the gist is a thing can be // displayed in list mode / grid mode, have some substate to enable loading state for upload, // can toggle links, potentially includes a thumbnail, can be used as a source and target for // drag and drop on other folders and many other non obvious stuff export function createThing({ link = null, label = "N/A", time = null, permissions = {} }) { const $thing = $tmpl.cloneNode(true); if ($thing instanceof HTMLElement) { const $label = $thing.querySelector(".component_filename .file-details > span"); if ($label instanceof HTMLElement) $label.textContent = label; // if (files[i]["type"] === "file") $node.querySelector("a").setAttribute("href", "/view" + path + files[i]["name"]); // else $node.querySelector("a").setAttribute("href", "/files" + path + files[i]["name"] + "/"); } return $thing; } export const css = CSS(import.meta.url, "thing.css");