mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 16:31:52 +01:00
implemented card gallery for lists
This commit is contained in:
@@ -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();
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user