source: Klonkt/src/views/partials/shared-styles.ejs@ 75c6919

main
Last change on this file since 75c6919 was 1c6d61c, checked in by roboburr <roboburr@…>, 3 months ago

fix(nav): Timeline/Grid active state via aria-selected (htmx-robust)

Root cause: body-attribute CSS (body[data-feed-view]) does NOT react reliably
after an htmx OOB swap; element attributes do. Therefore the active Timeline/Grid
state is now via [aria-selected="true"] (set by syncAria, which fires on
htmx:afterSettle) instead of body[data-feed-view]. syncAria sets aria-selected
only on feed pages → on calendar/downloads/post both are grey. Template also
sets the initial aria-selected neutral on non-feed pages.

Co-Authored-By: Claude <noreply@…>

  • Property mode set to 100644
File size: 8.4 KB
RevLine 
[7bc636b]1<style>
2/* ─────────────────────────────────────────────────
3 View switcher (timeline ↔ grid + grid-cols picker)
4 ───────────────────────────────────────────────── */
5.view-switcher-wrap {
6 border-bottom: 1px solid var(--rule);
7 background: var(--paper);
[dc4c067]8 /* Geen extra margin-top: de pill wordt zo gecentreerd tussen de profielkop-
9 streep (boven) en de eigen border (onder). De gelijke lucht boven/onder de
10 pill komt uit de symmetrische container-padding hieronder. De margin-bottom
11 (1.5rem in style.css) blijft lucht naar de feed. */
12 margin-top: 0;
[7bc636b]13}
14.view-switcher-wrap .container {
15 display: flex; align-items: center; justify-content: center; gap: 0.75rem;
[dc4c067]16 /* Symmetrische padding → even veel lucht boven als onder de pill (≈8px),
17 gecentreerd tussen de twee lijnen. */
18 padding: 0.5rem 1rem;
[7bc636b]19 max-width: 1200px; margin: 0 auto;
20 flex-wrap: wrap;
21}
22.view-switcher {
23 display: inline-flex;
24 background: var(--paper-2);
25 border: 1px solid var(--rule);
26 border-radius: 999px;
27 padding: 0.15rem;
28}
29.view-switch-btn {
30 display: inline-flex; align-items: center; gap: 0.35rem;
31 padding: 0.35rem 0.85rem;
32 border: 0; background: transparent; color: var(--ink-muted, var(--ink-soft));
33 cursor: pointer; border-radius: 999px;
34 font-size: 0.85rem; font-family: inherit;
35 transition: background 120ms, color 120ms;
36}
37.view-switch-btn:hover { color: var(--ink); }
[1c6d61c]38/* Actief = wit (lichte achtergrond, donkere tekst). Via aria-selected (element-
39 attribuut, door syncAria gezet + op htmx:afterSettle) → htmx-robuust. Op niet-
40 feed-pagina's zet syncAria aria-selected=false → beide grijs. */
41.view-switch-btn[aria-selected="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
[7bc636b]42
[1eff06a]43/* Agenda = een EIGEN pill (los van Tijdlijn/Grid, zodat de feed-toggle nooit
44 verstoord raakt). Zelfde look als de view-switcher-pill. Zichtbaar in alle modi. */
[6eeb459]45.agenda-pill { display: inline-flex; align-items: center; } /* geen box — losse icoon+tekst link */
[cf7c2d9]46.vs-agenda {
[6eeb459]47 display: inline-flex; align-items: center; gap: 0.4rem;
48 padding: 0.35rem 0.5rem;
[d7b5a6c]49 color: var(--ink-muted, var(--ink-soft));
50 text-decoration: none;
[6eeb459]51 font-size: 0.9rem; font-family: inherit;
52 transition: color 120ms;
[cf7c2d9]53}
[d7b5a6c]54.vs-agenda:hover { color: var(--ink); }
[4dcefa1]55/* Actief (op de agendapagina) = helder/wit. Element-class (in de OOB-gerenderde
56 chrome) i.p.v. body-class-CSS → werkt betrouwbaar ook na htmx-navigatie. */
57.vs-agenda.is-active { color: var(--ink); font-weight: 600; }
[cf7c2d9]58
[7bc636b]59.grid-cols-picker {
60 display: none; /* desktop-only, see media query */
61 gap: 0.2rem;
62}
63.grid-cols-btn {
64 width: 28px; height: 28px;
65 border: 1px solid var(--rule);
66 background: var(--paper-2);
67 color: var(--ink-muted, var(--ink-soft));
68 border-radius: 4px;
69 font-size: 0.8rem; font-weight: 600;
70 cursor: pointer;
71 font-variant-numeric: tabular-nums;
72}
73.grid-cols-btn:hover { color: var(--ink); border-color: var(--accent); }
74.grid-cols-btn.is-active { background: var(--accent); color: white; border-color: var(--accent); }
75
76/* Show grid-cols picker only on grid view + desktop */
77@media (min-width: 720px) {
78 body[data-feed-view="grid"] .grid-cols-picker { display: inline-flex; }
79}
80
81/* Switcher is hidden only on admin pages — admin has a dedicated layout
82 and its own back-button flow where Tijdlijn/Grid is irrelevant. On
83 every other page (home, post, tag, archive, search, account) it stays
84 visible so the user keeps a consistent return-to-feed control. */
85.on-admin .view-switcher-wrap { display: none; }
86
[af5407f]87/* Op een losse post is er geen feed om te schakelen, dus geen knop hoort "actief"
88 (gekleurd) te ogen. De actieve staat zit in style.css op body[data-feed-view]
89 / body[data-grid-cols] (background:var(--ink)); we overrulen die SPECIFIEKER
90 via body.on-post zodat de knoppen neutraal/grijs worden — maar wél klikbaar
91 blijven (de klik-handler navigeert dan naar de feed in die weergave). De
92 body-class wisselt client-side bij HTMX-nav, dus dit werkt ook zonder reload. */
93body.on-post[data-feed-view="timeline"] .view-switch-btn[data-view="timeline"],
94body.on-post[data-feed-view="grid"] .view-switch-btn[data-view="grid"],
95body.on-post[data-grid-cols="2"] .grid-cols-btn[data-cols="2"],
96body.on-post[data-grid-cols="3"] .grid-cols-btn[data-cols="3"],
[1eff06a]97body.on-post[data-grid-cols="4"] .grid-cols-btn[data-cols="4"] {
[af5407f]98 background: transparent;
99 color: var(--ink-muted, var(--ink-soft));
100 border-color: var(--rule);
[11a6871]101}
102
[6eeb459]103
[7bc636b]104/* Spacing between switcher-bar and the page content below.
105 .feed-timeline (used on home + archive + post-list pages) gets a top
106 margin so the first post doesn't collide with the switcher's border.
107 .feed-grid already has its own top spacing from grid-tile padding. */
108.view-switcher-wrap + #pcms-main .feed-timeline,
109.view-switcher-wrap + #pcms-main .container:first-child {
110 margin-top: 1.5rem;
111}
112
113/* Feed layout switching is in the v9 style.css (style.css):
114 .feed-timeline always rendered, .feed-grid hidden unless on-home + grid-mode. */
115
116/* ─────────────────────────────────────────────────
117 PWA install button (lives in topnav, hidden by default)
118 ───────────────────────────────────────────────── */
119#pwa-install-btn { color: var(--accent); }
120#pwa-install-btn:hover { background: var(--paper-2); }
121
122/* Shared button + form styles (used across pages) */
123.btn {
124 display: inline-flex;
125 align-items: center;
126 gap: 0.4rem;
127 padding: 0.55rem 1rem;
128 border: 1px solid var(--rule);
129 background: var(--paper-2);
130 color: var(--ink);
131 font-family: var(--font-ui, system-ui), sans-serif;
132 font-size: 0.9rem;
133 font-weight: 500;
134 text-decoration: none;
135 border-radius: 5px;
136 cursor: pointer;
137 transition: background 150ms, border-color 150ms;
138}
139.btn:hover { border-color: var(--accent); }
140.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
141.btn-primary:hover { opacity: 0.92; border-color: var(--accent); }
142.btn-success { background: #16a34a; color: white; border-color: #16a34a; }
143.btn-danger { background: #dc2626; color: white; border-color: #dc2626; }
144
145.alert { padding: 0.75rem 1rem; border-radius: 5px; margin-bottom: 1rem; }
146.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
147.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
148
149.auth-page { max-width: 420px; margin: 3rem auto; padding: 0 1rem; }
150.auth-page h1 { font-family: var(--font-display, serif); text-align: center; margin: 0 0 1.5rem; }
151.auth-form { display: flex; flex-direction: column; gap: 1rem; }
152.auth-form label { display: flex; flex-direction: column; gap: 0.3rem; }
153.auth-form label > span { font-size: 0.85rem; font-weight: 600; color: var(--ink-soft); }
154.auth-form input { padding: 0.6rem 0.75rem; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); color: var(--ink); font-size: 1rem; }
155.auth-form .btn { justify-content: center; padding: 0.7rem; font-size: 1rem; margin-top: 0.5rem; }
156.auth-link { text-align: center; color: var(--ink-muted); font-size: 0.9rem; margin: 1rem 0 0; }
157.auth-link a { color: var(--accent); }
[c80e78b]158.auth-google { align-items: stretch; }
159.auth-intro { text-align: center; color: var(--ink-muted); font-size: 0.95rem; margin: 0 0 1rem; }
160.btn-google {
[e2a8e31]161 display: flex; justify-content: center; gap: 0.6rem; padding: 0.7rem; font-size: 1rem;
[c80e78b]162 background: #fff; color: #1f1f1f; border: 1px solid #dadce0;
163}
164.btn-google:hover { background: #f7f8f8; border-color: #dadce0; }
165.btn-google .g-icon { flex-shrink: 0; }
[9e27d64]166.auth-divider { display: flex; align-items: center; gap: 0.75rem; margin: 1.25rem 0; color: var(--ink-muted); font-size: 0.85rem; }
167.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--rule); }
[7bc636b]168
169/* HTMX loading indicator */
170.pcms-loading {
171 display: none;
172 position: fixed;
173 top: 60px;
174 right: 1rem;
175 width: 24px;
176 height: 24px;
177 border: 3px solid var(--paper-2);
178 border-top-color: var(--accent);
179 border-radius: 50%;
180 animation: spin 0.8s linear infinite;
181 z-index: 1000;
182}
183.htmx-request .pcms-loading { display: block; }
184@keyframes spin { to { transform: rotate(360deg); } }
185</style>
Note: See TracBrowser for help on using the repository browser.