feat: add filetree component for shortcode

chore: update tailwind config and move hugo_stats
This commit is contained in:
Xin
2023-08-16 15:11:03 +01:00
parent 87ea9db336
commit db8374a724
10 changed files with 637 additions and 172 deletions

13
assets/js/filetree.js Normal file
View File

@ -0,0 +1,13 @@
// Script for filetree shortcode collapsing/expanding folders used in the theme
// ======================================================================
document.addEventListener("DOMContentLoaded", function () {
const folders = document.querySelectorAll(".hextra-filetree-folder");
folders.forEach(function (folder) {
folder.addEventListener("click", function () {
Array.from(folder.children).forEach(function (el) {
el.dataset.state = el.dataset.state === "open" ? "closed" : "open";
});
folder.nextElementSibling.dataset.state = folder.nextElementSibling.dataset.state === "open" ? "closed" : "open";
});
});
});