diff options
| author | Adam Mathes <adam@adammathes.com> | 2026-02-15 20:47:26 -0800 |
|---|---|---|
| committer | Adam Mathes <adam@adammathes.com> | 2026-02-15 20:47:26 -0800 |
| commit | 27bd895a5ff0b95045ea6a26b9440874b1c6bf0e (patch) | |
| tree | c579405e33a77628f11de9429f2a19455d93c2c7 /frontend-vanilla/src | |
| parent | d98873787ec40938a4fafdb9bee562b494428f71 (diff) | |
| download | neko-27bd895a5ff0b95045ea6a26b9440874b1c6bf0e.tar.gz neko-27bd895a5ff0b95045ea6a26b9440874b1c6bf0e.tar.bz2 neko-27bd895a5ff0b95045ea6a26b9440874b1c6bf0e.zip | |
Vanilla JS (v3): Reduce font size and implement collapsible sidebar sections for Tags and Feeds
Diffstat (limited to 'frontend-vanilla/src')
| -rw-r--r-- | frontend-vanilla/src/main.ts | 17 | ||||
| -rw-r--r-- | frontend-vanilla/src/style.css | 61 |
2 files changed, 55 insertions, 23 deletions
diff --git a/frontend-vanilla/src/main.ts b/frontend-vanilla/src/main.ts index 400bf7b..3553ea7 100644 --- a/frontend-vanilla/src/main.ts +++ b/frontend-vanilla/src/main.ts @@ -44,12 +44,12 @@ export function renderLayout() { <li class="filter-item" data-filter="starred"><a href="/v3/?filter=starred" data-nav="filter" data-value="starred">Starred</a></li> </ul> </section> - <section class="sidebar-section"> - <h3>Tags</h3> + <section class="sidebar-section collapsible collapsed" id="section-tags"> + <h3>Tags <span class="caret">▶</span></h3> <ul id="tag-list"></ul> </section> - <section class="sidebar-section"> - <h3>Feeds</h3> + <section class="sidebar-section collapsible collapsed" id="section-feeds"> + <h3>Feeds <span class="caret">▶</span></h3> <ul id="feed-list"></ul> </section> </div> @@ -96,6 +96,13 @@ export function attachLayoutListeners() { } }); + // Collapsible sections + document.querySelectorAll('.sidebar-section.collapsible h3').forEach(header => { + header.addEventListener('click', () => { + header.parentElement?.classList.toggle('collapsed'); + }); + }); + // Event delegation for filters, tags, and feeds in sidebar const sidebar = document.getElementById('sidebar'); sidebar?.addEventListener('click', (e) => { @@ -420,9 +427,11 @@ function handleRoute() { const id = parseInt(route.params.feedId); store.setActiveFeed(id); fetchItems(route.params.feedId); + document.getElementById('section-feeds')?.classList.remove('collapsed'); } else if (route.path === '/tag' && route.params.tagName) { store.setActiveTag(route.params.tagName); fetchItems(undefined, route.params.tagName); + document.getElementById('section-tags')?.classList.remove('collapsed'); } else { store.setActiveFeed(null); store.setActiveTag(null); diff --git a/frontend-vanilla/src/style.css b/frontend-vanilla/src/style.css index 1002035..1b3efc4 100644 --- a/frontend-vanilla/src/style.css +++ b/frontend-vanilla/src/style.css @@ -5,7 +5,8 @@ --font-sans: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; line-height: 1.5; - font-size: 18px; + font-size: 15px; + /* Reduced from 18px */ /* Light Mode Defaults */ --bg-color: #ffffff; @@ -88,13 +89,38 @@ body { .sidebar-section h3 { font-family: var(--font-sans); - font-size: 0.75rem; + font-size: 0.7rem; + /* Slightly smaller */ text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.5; margin-top: 2rem; margin-bottom: 0.5rem; - font-weight: 600; + font-weight: 700; + display: flex; + align-items: center; + justify-content: space-between; + cursor: pointer; + user-select: none; +} + +.sidebar-section h3:hover { + opacity: 0.8; +} + +.sidebar-section .caret { + font-size: 0.6rem; + transition: transform 0.2s ease; + transform: rotate(90deg); + /* Expanded by default in CSS, but we'll set collapsed in HTML */ +} + +.sidebar-section.collapsed .caret { + transform: rotate(0deg); +} + +.sidebar-section.collapsed ul { + display: none; } .sidebar-section ul { @@ -105,11 +131,14 @@ body { .sidebar-section li a { display: block; - padding: 0.4rem 0.8rem; - margin: 0.2rem 0; + padding: 0.3rem 0.8rem; + /* Tighter padding */ + margin: 0.1rem 0; border-radius: 8px; transition: all 0.2s ease; font-weight: 500; + font-size: 0.9rem; + /* Explicit smaller size */ text-decoration: none; color: var(--text-color); opacity: 0.8; @@ -246,10 +275,16 @@ body { box-shadow: 10px 0 20px rgba(0, 0, 0, 0.1); } - /* Keep toggle visible but maybe adjust position if needed */ + /* Move toggle button with sidebar when visible */ + .sidebar-visible .sidebar-toggle { + left: 12rem; + } +} + +/* Desktop Sidebar state */ +@media (min-width: 769px) { .sidebar-visible .sidebar-toggle { left: 12rem; - /* Move out with sidebar if desired, or keep fixed */ } } @@ -266,11 +301,6 @@ body { .sidebar-visible .sidebar { display: flex; } - - /* On desktop, hide toggle unless we want to allow hiding sidebar manually */ - .sidebar-toggle { - display: none; - } } /* Feed Items Styles (from v2) */ @@ -440,11 +470,4 @@ button.active { .theme-dark button.active { background-color: #224; border-color: var(--accent-color); -} - -@media (max-width: 768px) { - .sidebar { - display: none; - /* Mobile sidebar will need to be handled later */ - } }
\ No newline at end of file |
