aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/components/ScheduleMonthLinks.astro
blob: 9f553df50d2c24a6f715619281a1d2252e94d364 (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
---
// 月別・年度別アーカイブのリンク一覧。行事予定ページの下部に置く。
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),
}));
---

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