aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/components/ScheduleMonthLinks.astro
blob: adf3b32affecd7e623c6107c3156ba46b5655d69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
---
// 月別・年度別アーカイブのリンク一覧。行事予定ページの下部に置く。
import {
  fiscalYearKeys,
  fiscalYearLabel,
  fiscalYearOf,
  monthCounts,
  monthKeys,
  monthLabel,
} from '@/lib/schedule-months';
import { scheduleUrl } from '@/data/schedule/config';

const groups = fiscalYearKeys.map((fy) => ({
  key: fy,
  label: fiscalYearLabel(fy),
  months: monthKeys.filter((month) => fiscalYearOf(month) === fy),
}));
---

<div class="schedule-archive">
  {
    groups.map((group) => (
      <section class="schedule-archive-year">
        <h3 class="schedule-archive-year-title">
          <a href={scheduleUrl(`${group.key}/`)}>{group.label}の予定</a>
        </h3>
        <ul class="schedule-archive-months">
          {group.months.map((key) => (
            <li>
              <a href={scheduleUrl(`${key}/`)}>
                <span>{monthLabel(key)}</span>
                <span class="schedule-archive-count">{monthCounts[key]}件</span>
              </a>
            </li>
          ))}
        </ul>
      </section>
    ))
  }
</div>