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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
|
---
// 公園・公共施設の一覧を絞り込むコントロール。地図の上に表示する。
// 実際の絞り込みは 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>
<span class="parks-search-wrap">
<input type="search" data-parks-search placeholder="名称・住所・設備など" />
<button
type="button"
class="parks-search-clear"
data-parks-search-clear
aria-label="キーワードを削除"
title="キーワードを削除"
hidden>×</button>
</span>
</label>
<label class="parks-unconfirmed-filter" title="名称・住所などが未確認の公園だけを表示">
<input type="checkbox" data-parks-unconfirmed />
未確認のみ
</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="clock" />⏰時計</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="basket" />バスケゴール</label>
<label><input type="checkbox" data-fac-filter value="shelter" />東屋/シェルター</label>
<label><input type="checkbox" data-fac-filter value="health" />健康遊具</label>
<label><input type="checkbox" data-fac-filter value="special" />特殊遊具</label>
</fieldset>
<label class="parks-fire-toggle" title="消火栓・防火水槽を地図に表示する">
<input type="checkbox" data-show-fire />
消火栓・防火水槽
</label>
<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;
}
/* Starlight の "* + *" の上下マージンが flex 行内で上下ズレを起こすため打ち消す */
.parks-controls > * {
margin: 0;
}
.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;
}
/* 选择中的フィルタを目立たせる */
.parks-controls label:has(input[type="checkbox"]:checked) {
padding: 0 0.35rem;
border-radius: 999px;
background: var(--sl-color-accent-low, #dbeafe);
outline: 1px solid var(--sl-color-accent, #2563eb);
color: var(--sl-color-text, inherit);
font-weight: 700;
}
.filter-icon {
display: inline-flex;
width: 18px;
height: 18px;
flex: none;
}
.filter-icon :global(svg) {
display: block;
width: 100%;
height: 100%;
}
.parks-count {
margin-left: auto;
font-size: 0.9rem;
opacity: 0.75;
}
.parks-search-wrap {
position: relative;
display: inline-flex;
align-items: center;
}
.parks-search-wrap input[type="search"] {
padding-right: 1.9rem;
}
.parks-search-clear {
position: absolute;
right: 0.3rem;
display: inline-flex;
align-items: center;
justify-content: center;
width: 1.4rem;
height: 1.4rem;
padding: 0;
border: 0;
border-radius: 50%;
background: transparent;
color: inherit;
font-size: 1rem;
line-height: 1;
cursor: pointer;
}
.parks-search-clear:hover {
background: var(--sl-color-gray-5, #e2e8f0);
}
.parks-search-clear[hidden] {
display: none;
}
.parks-disclaimer {
margin: 0 0 0.55rem;
color: var(--sl-color-gray-2);
font-size: 0.78rem;
}
</style>
|