Skip to content

Commit d2c4ba9

Browse files
committed
Show all icons from the current release in the sidebar instead of just one
1 parent 8ca9a2a commit d2c4ba9

File tree

4 files changed

+55
-35
lines changed

4 files changed

+55
-35
lines changed

docs/css/main.css

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ h1 {
3131
h2 {
3232
font-size: 18px;
3333
font-weight: 700;
34-
margin-bottom: 10px;
35-
border-bottom: 1px dashed var(--text-color);
36-
padding-bottom: 10px;
3734
}
3835
hr {
3936
border: 0;
@@ -70,13 +67,24 @@ img.inline-icon, a.inline-icon img {
7067
display: flex;
7168
flex-direction: column;
7269
flex-basis: 200px;
73-
line-height: 2em;
70+
line-height: 1.5em;
7471
border-left: 1px solid var(--text-color);
7572
padding-left: 16px;
7673
}
7774
#sidebar a {
7875
width: fit-content;
7976
}
77+
#sidebar > * {
78+
margin-bottom: 10px;
79+
}
80+
.version-title {
81+
padding-bottom: 10px;
82+
border-bottom: 1px dashed var(--text-color);
83+
}
84+
#sidebar .icon-grid {
85+
padding-bottom: 10px;
86+
border-bottom: 1px dashed var(--text-color);
87+
}
8088
article {
8189
line-height: 22px;
8290
}
@@ -106,21 +114,23 @@ article > * {
106114
}
107115

108116
#icon-gallery {
117+
padding-bottom: 30px;
118+
border-bottom: 2px solid var(--text-color);
119+
}
120+
.icon-grid {
109121
display: flex;
110122
flex-wrap: wrap;
111123
gap: 5px;
112-
padding-bottom: 30px;
113-
border-bottom: 2px solid var(--text-color);
114124
}
115-
#icon-gallery a {
125+
.icon-grid a {
116126
min-width: 0;
117127
min-height: 0;
118128
display:block;
119129
width:15px;
120130
height:15px;
121131
flex:0 0 15px;
122132
}
123-
#icon-gallery a svg {
133+
.icon-grid a svg {
124134
min-width: 0;
125135
min-height: 0;
126136
display:block;

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
</div>
3535
</div>
3636
<hr/>
37-
<div id="icon-gallery"></div>
37+
<div id="icon-gallery" class="icon-grid"></div>
3838
<div id="body-area">
3939
<article>
4040
<p><span style="font-size: 1.5em;">So you're making a map</span> and need some <b>icons</b>. Well, maybe <b>a lot</b> of icons. Like, for anything that might appear on a <b>map</b>. And they need to be visually <b>consistent</b>. Like the size and direction and whatever. And they gotta be <b>free</b>. Even <b>public domain</b>. In <b>vector</b> format. With <b>no AI</b>. Oh, and they all need to be <b>legible</b> on the <b>head of a pin</b>.</p>

docs/index.js

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ window.addEventListener('load', _ => {
1616
});
1717
});
1818

19-
function setupPage(pageData) {
19+
async function setupPage(pageData) {
20+
const migrations = await fetch('migrations.json')
21+
.then(result => result.json());
22+
23+
const currentMigrations = migrations.find(item => item.to_major_version === majorVersion);
24+
const newIconIds = currentMigrations.icon_migrations.filter(mig => mig.new_id && (!mig.old_id || mig.redesign)).map(mig => mig.new_id);
25+
2026
const parser = new DOMParser();
2127
const icons = pageData.icons;
2228

@@ -28,17 +34,21 @@ function setupPage(pageData) {
2834
document.getElementById('sidebar')
2935
.insertAdjacentHTML("afterbegin", [
3036
new Chainable('h2')
31-
.append(
32-
new Chainable('a')
33-
.setAttribute('class', 'inline-icon')
34-
.setAttribute('href', '#' + packageJson.versionIcon.slice(0, -4).split('/').slice(-1)[0])
35-
.append(
36-
new Chainable('img')
37-
.setAttribute('src', packageJson.versionIcon || "/v1/heart.svg")
38-
),
39-
new Chainable('span')
40-
.append('v' + version)
37+
.setAttribute('class', 'version-title')
38+
.append('v' + version),
39+
new Chainable('div')
40+
.setAttribute('class', 'icon-grid')
41+
.insertAdjacentHTML("afterbegin",
42+
newIconIds.map(iconId => {
43+
const icon = icons[iconId];
44+
return new Chainable('a')
45+
.setAttribute('href', '#' + iconId)
46+
.setAttribute('title', iconId)
47+
.insertAdjacentHTML("afterbegin", icon.svg)
48+
}
49+
).join('')
4150
),
51+
4252
new Chainable('a')
4353
.setAttribute('href', `https://github.com/waysidemapping/pinhead/releases/download/v${version}/waysidemapping-pinhead-${version}.tgz`)
4454
.append(

migrations.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,34 +73,33 @@
7373
"new_id": "car_profile_with_raised_hood"
7474
},
7575
{
76-
"new_id": "compact_box_truck"
77-
},
78-
{
79-
"new_id": "compact_box_truck_with_greek_cross"
76+
"new_id": "pickup_truck"
8077
},
8178
{
82-
"new_id": "compact_box_truck_with_heavy_six_point_asterisk"
79+
"new_id": "pickup_truck_with_raised_hood"
8380
},
8481
{
85-
"new_id": "flatbed_truck"
82+
"new_id": "pickup_truck_with_crates"
8683
},
8784
{
88-
"new_id": "pickup_truck"
85+
"new_id": "pickup_truck_with_slidein_camper"
8986
},
9087
{
91-
"new_id": "pickup_truck_with_crates"
88+
"new_id": "compact_box_truck"
9289
},
9390
{
94-
"new_id": "pickup_truck_with_raised_hood"
91+
"new_id": "compact_box_truck_with_greek_cross"
9592
},
9693
{
97-
"new_id": "pickup_truck_with_slidein_camper"
94+
"new_id": "compact_box_truck_with_heavy_six_point_asterisk"
9895
},
9996
{
100-
"new_id": "mobile_phone_with_keypad_and_antenna_and_wifi"
97+
"old_id": "truck_profile",
98+
"new_id": "box_truck",
99+
"redesign": true
101100
},
102101
{
103-
"new_id": "mobile_phone_with_touchscreen_and_antenna_and_wifi"
102+
"new_id": "flatbed_truck"
104103
},
105104
{
106105
"new_id": "maple_leaf"
@@ -111,9 +110,10 @@
111110
"redesign": true
112111
},
113112
{
114-
"old_id": "truck_profile",
115-
"new_id": "box_truck",
116-
"redesign": true
113+
"new_id": "mobile_phone_with_keypad_and_antenna_and_wifi"
114+
},
115+
{
116+
"new_id": "mobile_phone_with_touchscreen_and_antenna_and_wifi"
117117
}
118118
]
119119
}

0 commit comments

Comments
 (0)