1
0
mirror of https://github.com/morris/vanilla-todo.git synced 2025-08-22 21:52:54 +02:00

first commit

This commit is contained in:
Morris Brodersen
2020-10-20 17:27:16 +02:00
commit e36cdfeb11
39 changed files with 5914 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
/* global VT */
window.VT = window.VT || {};
VT.AppCollapsible = function (el) {
var state = {
show: true,
};
el.querySelector('.bar > .toggle').addEventListener('click', function () {
update({ show: !state.show });
});
el.appCollapsible = {
update: update,
};
function update(next) {
Object.assign(state, next);
el.querySelector('.bar > .toggle > .app-icon').classList.toggle(
'-r180',
state.show
);
el.querySelectorAll('.body').forEach(function (el) {
el.style.height = state.show ? el.children[0].offsetHeight + 'px' : '0';
});
}
};