summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/ScheduleInteractive.astro45
-rw-r--r--src/styles/custom.css3
2 files changed, 32 insertions, 16 deletions
diff --git a/src/components/ScheduleInteractive.astro b/src/components/ScheduleInteractive.astro
index b7c8481..b795613 100644
--- a/src/components/ScheduleInteractive.astro
+++ b/src/components/ScheduleInteractive.astro
@@ -398,38 +398,51 @@
return `${activeCategory} ${categoryLabel(activeCategory)}`;
}
- function ensureStatus(container, type) {
- const id = `${type}-filter-status`;
+ function ensureStatus(container, type, where = 'before') {
+ const id = `${type}-filter-status-${where}`;
let status = document.getElementById(id);
if (!status) {
status = document.createElement('div');
status.id = id;
- status.className = 'schedule-table-status';
+ status.className =
+ where === 'after'
+ ? 'schedule-table-status schedule-table-status--below'
+ : 'schedule-table-status';
status.setAttribute('role', 'status');
status.setAttribute('aria-live', 'polite');
- container.parentElement.insertBefore(status, container);
+ if (where === 'after') container.after(status);
+ else container.parentElement.insertBefore(status, container);
}
return status;
}
- const meetingStatus = ensureStatus(meetingsTable.parentElement, 'meeting');
- const eventStatus = ensureStatus(eventsTable.parentElement, 'event');
+ // 表の上と下の両方に、絞り込みの状態を出す(長い表でも見失わないように)。
+ const meetingStatus = [
+ ensureStatus(meetingsTable.parentElement, 'meeting', 'before'),
+ ensureStatus(meetingsTable.parentElement, 'meeting', 'after'),
+ ];
+ const eventStatus = [
+ ensureStatus(eventsTable.parentElement, 'event', 'before'),
+ ensureStatus(eventsTable.parentElement, 'event', 'after'),
+ ];
- function updateTableStatus(status, type, total, visible) {
+ function updateTableStatus(statusList, type, total, visible) {
const tableLabel = type === 'meeting' ? '審議会等・市議会' : 'イベント';
const filtered = activeCategory !== 'all';
- status.classList.toggle('is-filtered', filtered);
const text = filtered
? `${tableLabel}:「${filterLabel()}」で絞り込み中:${visible}件/全${total}件`
: `${tableLabel}:全${total}件を表示しています(絞り込みなし)`;
- status.innerHTML = `<span class="schedule-table-status-text">${text}</span>`;
- if (filtered) {
- const clear = document.createElement('button');
- clear.type = 'button';
- clear.className = 'schedule-table-status-clear';
- clear.textContent = '絞り込みを解除';
- clear.addEventListener('click', () => setActiveCategory('all'));
- status.appendChild(clear);
+ for (const status of statusList) {
+ status.classList.toggle('is-filtered', filtered);
+ status.innerHTML = `<span class="schedule-table-status-text">${text}</span>`;
+ if (filtered) {
+ const clear = document.createElement('button');
+ clear.type = 'button';
+ clear.className = 'schedule-table-status-clear';
+ clear.textContent = '絞り込みを解除';
+ clear.addEventListener('click', () => setActiveCategory('all'));
+ status.appendChild(clear);
+ }
}
}
diff --git a/src/styles/custom.css b/src/styles/custom.css
index db35dd8..bfa0c0d 100644
--- a/src/styles/custom.css
+++ b/src/styles/custom.css
@@ -2409,6 +2409,9 @@ td.sanpi-open .sanpi-title {
color: var(--sl-color-gray-3);
font-size: 0.85rem;
}
+.schedule-table-status--below {
+ margin: 0.3rem 0 0.8rem;
+}
.schedule-table-status.is-filtered {
border-color: var(--sl-color-accent);
background: var(--sl-color-accent-low);