aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/components/ParksFilters.astro
blob: bf65d6e6b1b68e861cc07760d183a2bbd079d36a (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
---
// 公園・公共施設の一覧を絞り込むコントロール。地図の上に表示する。
// 実際の絞り込みは ParksTable.astro のスクリプトが行う。
import { parks, towns, total } from "@/data/parks-rows";
import { PARK_ICONS } from "@/data/park-icons";

const facilityTypes = [
  "図書館",
  "公民館",
  "児童館",
  "地域センター",
  "市役所支所",
  "文化施設",
].filter((type) =>
  parks.some((p) => p["施設"] === "1" && p["種別"] === type),
);
---

<div class="parks-controls" data-parks-filters>
  <label>
    <span>種類</span>
    <select data-parks-kind>
      <option value="">すべて</option>
      <option value="park">公園</option>
      {facilityTypes.map((type) => (
        <option value={type}>{type}</option>
      ))}
    </select>
  </label>
  <label>
    <span>町名</span>
    <select data-parks-town>
      <option value="">すべての町名</option>
      {towns.map((town) => (
        <option value={town}>{town}</option>
      ))}
    </select>
  </label>
  <label>
    <span>キーワード</span>
    <input type="search" data-parks-search placeholder="名称・住所・設備など" />
  </label>
  <fieldset class="parks-facilities">
    <legend>設備・遊具で絞る</legend>
    <label><input type="checkbox" data-fac-filter value="toilet" />トイレ</label>
    <label><input type="checkbox" data-fac-filter value="water" />水飲み場・給水</label>
    <label>
      <input type="checkbox" data-fac-filter value="picnic" />
      <span class="filter-icon" set:html={PARK_ICONS.picnic.svg} />ピクニック・広場
    </label>
    <label><input type="checkbox" data-fac-filter value="toy" />遊具あり</label>
    <label>
      <input type="checkbox" data-fac-filter value="sand" />
      <span class="filter-icon" set:html={PARK_ICONS.sand.svg} />砂場
    </label>
    <label>
      <input type="checkbox" data-fac-filter value="swing" />
      <span class="filter-icon" set:html={PARK_ICONS.swing.svg} />ブランコ
    </label>
    <label>
      <input type="checkbox" data-fac-filter value="seesaw" />
      <span class="filter-icon" set:html={PARK_ICONS.teeter.svg} />シーソー
    </label>
    <label>
      <input type="checkbox" data-fac-filter value="spring" />
      <span class="filter-icon" set:html={PARK_ICONS.spring.svg} />スプリング遊具
    </label>
    <label>
      <input type="checkbox" data-fac-filter value="jungle" />
      <span class="filter-icon" set:html={PARK_ICONS.climbing.svg} />ジャングルジム
    </label>
    <label>
      <input type="checkbox" data-fac-filter value="plane" />
      <span class="filter-icon" set:html={PARK_ICONS.airplane.svg} />ヒコーキ
    </label>
    <label>
      <input type="checkbox" data-fac-filter value="slide" />
      <span class="filter-icon" set:html={PARK_ICONS.slide.svg} />滑り台
    </label>
    <label>
      <input type="checkbox" data-fac-filter value="complex" />
      <span class="filter-icon" set:html={PARK_ICONS.playground.svg} />複合遊具
    </label>
    <label>
      <input type="checkbox" data-fac-filter value="rope" />
      <span class="filter-icon" set:html={PARK_ICONS.flyingfox.svg} />ロープウェイ
    </label>
    <label>
      <input type="checkbox" data-fac-filter value="ball" />
      <span class="filter-icon" set:html={PARK_ICONS.ball.svg} />ボール遊び
    </label>
  </fieldset>
  <span class="parks-count" data-parks-count aria-live="polite">{total}件</span>
</div>

<p class="parks-disclaimer">
  情報には誤りが含まれる場合があります。最新の情報は各施設の公式ページでご確認ください。
</p>

<style>
  .parks-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.9rem;
    align-items: center;
    margin: 0 0 0.55rem;
  }
  .parks-controls label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 2.1rem;
    font-size: 0.9rem;
    line-height: 1.2;
  }
  .parks-controls label > span {
    line-height: 1.2;
  }
  .parks-controls select,
  .parks-controls input[type="search"] {
    height: 2.1rem;
    box-sizing: border-box;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--sl-color-hairline, #ccc);
    border-radius: 0.3rem;
    background: var(--sl-color-bg, #fff);
    color: var(--sl-color-text, inherit);
    font: inherit;
    line-height: 1.2;
  }
  .parks-facilities {
    display: flex;
    flex-wrap: wrap;
    gap: 0.1rem 0.6rem;
    align-items: center;
    margin: 0;
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--sl-color-hairline, #ccc);
    border-radius: 0.3rem;
  }
  .parks-facilities legend {
    padding: 0 0.2rem;
    font-size: 0.78em;
    color: inherit;
    opacity: 0.7;
  }
  .parks-facilities label {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    min-height: 1.5rem;
    font-size: 0.8rem;
    line-height: 1.2;
  }
  .parks-facilities input[type="checkbox"] {
    width: 0.9em;
    height: 0.9em;
    margin: 0;
  }
  .filter-icon {
    display: inline-flex;
    width: 18px;
    height: 18px;
    flex: none;
  }
  .filter-icon :global(svg) {
    display: block;
    width: 100%;
    height: 100%;
  }
  :global(.filter-icon svg *) {
    vector-effect: non-scaling-stroke;
  }
  .parks-count {
    margin-left: auto;
    font-size: 0.9rem;
    opacity: 0.75;
  }
  .parks-disclaimer {
    margin: 0 0 0.55rem;
    color: var(--sl-color-gray-2);
    font-size: 0.78rem;
  }
</style>