diff --git a/static/app.css b/static/app.css index 9911970..53870e1 100644 --- a/static/app.css +++ b/static/app.css @@ -346,4 +346,25 @@ footer { @keyframes spin { to { transform: rotate(360deg); } +} + +.card-body.collapsable { + display: none; + transition: max-height 0.3s ease; + overflow: hidden; + +} + +.card-body.collapsable.show { + display: block; + max-height: 1000px; +} + +.toggle-icon { + font-size: 1.25rem; + user-select: none; +} + +.toggle-icon:hover { + color: #007bff; } \ No newline at end of file diff --git a/static/app.js b/static/app.js index cf4e913..97117b1 100644 --- a/static/app.js +++ b/static/app.js @@ -498,4 +498,56 @@ function syncThemeColor() { .forEach(svg => svg.setAttribute('fill', cssVar)); } -document.addEventListener('DOMContentLoaded', syncThemeColor); \ No newline at end of file +document.addEventListener('DOMContentLoaded', syncThemeColor); + + +// toggle card visibility +document.addEventListener('DOMContentLoaded', function() { + // 1. Select all plus/minus icons + var icons = document.querySelectorAll('.card .toggle-icon'); + + icons.forEach(function(icon) { + // 2. For each icon, find its corresponding collapsable body + var card = icon.closest('.card'); + if (!card) return; + + var body = card.querySelector('.card-body.collapsable'); + if (!body) return; + + // 3. Initialize aria‐expanded & icon text based on whether .show is present + if (body.classList.contains('show')) { + icon.textContent = '–'; + icon.setAttribute('aria-expanded', 'true'); + } else { + icon.textContent = '+'; + icon.setAttribute('aria-expanded', 'false'); + } + + function toggleSection() { + // Toggle the 'show' class + if (body.classList.contains('show')) { + body.classList.remove('show'); + icon.textContent = '+'; + icon.setAttribute('aria-expanded', 'false'); + } else { + body.classList.add('show'); + icon.textContent = '–'; + icon.setAttribute('aria-expanded', 'true'); + } + } + + // 4. Click listener + icon.addEventListener('click', function(e) { + e.stopPropagation(); + toggleSection(); + }); + + // 5. Keydown listener (Enter/Space for accessibility) + icon.addEventListener('keydown', function(e) { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); + toggleSection(); + } + }); + }); + }); \ No newline at end of file diff --git a/templates/connections.html b/templates/connections.html index 67b59b9..e89f48c 100644 --- a/templates/connections.html +++ b/templates/connections.html @@ -26,7 +26,7 @@ {% block content %}