implemented card gallery for lists

This commit is contained in:
Nuno Coração
2022-11-05 15:11:20 +00:00
parent d2dcbf8830
commit f2d3ff1572
16 changed files with 430 additions and 107 deletions

View File

@@ -1,9 +1,9 @@
var layouts = [
"profile",
"background",
"hero",
"profile",
"card",
"page"
"page",
"card"
]
var currentLayout = 0
@@ -33,3 +33,48 @@ window.addEventListener("DOMContentLoaded", (event) => {
})
);
});
var list_config = [
"CardViewProse",
"CardViewScreenWidth",
"NormalView"
]
var titles = {
"CardViewProse" : "card view with constrained width",
"CardViewScreenWidth" : "card view with full width",
"NormalView" : "standard list view"
}
var currentConfig = 0
function switchList() {
var old = currentConfig
currentConfig = currentConfig == list_config.length - 1 ? 0 : currentConfig + 1
var oldDiv = document.getElementById(list_config[old])
var currentDiv = document.getElementById(list_config[currentConfig])
const configCode = document.querySelectorAll("code[id=config]");
console.log(currentConfig)
console.log(oldDiv)
console.log(currentDiv)
currentDiv.style.display = "block";
oldDiv.style.display = "none";
configCode.forEach(function (el) {
el.innerText = titles[list_config[currentConfig]];
});
}
window.addEventListener("DOMContentLoaded", (event) => {
document.querySelectorAll("#switch-config-button").forEach((button) =>
button.addEventListener("click", function (e) {
e.preventDefault();
switchList();
})
);
});