Skip to content

Commit 8b66553

Browse files
committed
Add download icon. Make sure homepage links are for latest v
1 parent c010d66 commit 8b66553

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

docs/css/main.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ hr {
3636
}
3737

3838
img.inline {
39-
height: 1em;
40-
aspect-ratio: 0.8;
39+
height: 0.85em;
40+
aspect-ratio: 1;
4141
}
4242
img.inline:not(:first-child) {
4343
margin-left: 4px;

docs/index.js

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
let packageJson;
22

3+
let version;
4+
let majorVersion
5+
36
window.addEventListener('load', _ => {
47
fetch('package.json')
58
.then(result => result.json())
69
.then(obj => {
710
packageJson = obj;
8-
const majorVersion = packageJson.version.split('.')[0];
11+
version = packageJson.version;
12+
majorVersion = version.split('.')[0];
913
fetch(`v${majorVersion}/index.complete.json`)
1014
.then(result => result.json())
1115
.then(setupPage);
@@ -29,30 +33,36 @@ function setupPage(pageData) {
2933
.setAttribute('class', 'inline')
3034
.setAttribute('src', packageJson.versionIcon || "https://pinhead.ink/v1/heart.svg"),
3135
new Chainable('span')
32-
.append('v' + packageJson.version)
36+
.append('v' + version)
3337
),
3438
new Chainable('a')
35-
.setAttribute('href', `https://github.com/waysidemapping/pinhead/releases/download/v${packageJson.version}/waysidemapping-pinhead-${packageJson.version}.tgz`)
36-
.append('download'),
39+
.setAttribute('href', `https://github.com/waysidemapping/pinhead/releases/download/v${version}/waysidemapping-pinhead-${version}.tgz`)
40+
.append(
41+
new Chainable('span')
42+
.append('download'),
43+
new Chainable('img')
44+
.setAttribute('class', 'inline')
45+
.setAttribute('src', "https://pinhead.ink/v2/arrow_down_to_down_bracket.svg")
46+
),
3747
new Chainable('a')
38-
.setAttribute('href', `https://www.npmjs.com/package/@waysidemapping/pinhead/v/${packageJson.version}`)
48+
.setAttribute('href', `https://www.npmjs.com/package/@waysidemapping/pinhead/v/${version}`)
3949
.setAttribute('target', '_blank')
4050
.append(
4151
new Chainable('span')
4252
.append('npm package'),
4353
new Chainable('img')
4454
.setAttribute('class', 'inline')
45-
.setAttribute('src', "https://pinhead.ink/v1/arrow_top_right_from_square_outline.svg")
55+
.setAttribute('src', `https://pinhead.ink/v${majorVersion}/arrow_top_right_from_square_outline.svg`)
4656
),
4757
new Chainable('a')
48-
.setAttribute('href', `https://github.com/waysidemapping/pinhead/releases/tag/v${packageJson.version}`)
58+
.setAttribute('href', `https://github.com/waysidemapping/pinhead/releases/tag/v${version}`)
4959
.setAttribute('target', '_blank')
5060
.append(
5161
new Chainable('span')
5262
.append('github release'),
5363
new Chainable('img')
5464
.setAttribute('class', 'inline')
55-
.setAttribute('src', "https://pinhead.ink/v1/arrow_top_right_from_square_outline.svg")
65+
.setAttribute('src', `https://pinhead.ink/v${majorVersion}/arrow_top_right_from_square_outline.svg`)
5666
)
5767
].join(''));
5868

@@ -115,12 +125,12 @@ function setupPage(pageData) {
115125
.setAttribute('class', 'links')
116126
.append(
117127
new Chainable('a')
118-
.setAttribute('href', `v1/${iconId}.svg`)
128+
.setAttribute('href', `v${majorVersion}/${iconId}.svg`)
119129
.append(
120130
'open'
121131
),
122132
new Chainable('a')
123-
.setAttribute('href', `v1/${iconId}.svg`)
133+
.setAttribute('href', `v${majorVersion}/${iconId}.svg`)
124134
.setAttribute('download', true)
125135
.append(
126136
'download'

0 commit comments

Comments
 (0)