Skip to content

Commit 539f618

Browse files
committed
feat: add download page
Signed-off-by: seven <[email protected]>
1 parent 20036e1 commit 539f618

File tree

4 files changed

+65
-3
lines changed

4 files changed

+65
-3
lines changed

docs/.vitepress/config.mts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ export default defineConfig({
2626
{
2727
text: 'Download',
2828
items: [
29-
{text: 'mac', link: '/markdown-examples'},
30-
{text: 'linux', link: '/api-examples'},
31-
{text: 'windows', link: '/api-examples'}
29+
{text: 'Download', link: '/download'},
3230
]
3331
}
3432
],
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<script setup>
2+
const platform = {
3+
MacIntel: 'x64.dmg',
4+
Win32: 'Setup.exe',
5+
'Linux x86_64': '_amd64.deb',
6+
'Linux armv81': '_arm64.deb'
7+
};
8+
const getLatestLinks = async () => {
9+
const data = await fetch('https://api.github.com/repos/geek-fun/dockit/releases/latest')
10+
.then((res) => res.json())
11+
.catch((err) => console.error(err));
12+
return data.assets.map((item) => ({
13+
name: item.name,
14+
url: item.browser_download_url
15+
}));
16+
}
17+
18+
const downloadFn = async (event) => {
19+
// const links = await getLatestLinks();
20+
// const link = links.find((item) => item.name.includes(platform[window.navigator.platform]));
21+
// console.log('downloadFn', fetch(link.url))
22+
console.log('downloadFn',window.navigator)
23+
console.log('downloadFnJson',{ nv: JSON.stringify(window.navigator)})
24+
}
25+
</script>
26+
<template>
27+
<p>
28+
Download the the latest of DocKit for your platform, or you can find the historic/cross-platforms version in
29+
<a href="https://github.com/geek-fun/dockit/releases">github release</a>
30+
</p>
31+
<button :class="$style.downloadButton" @click="downloadFn"><i class="fab fa-apple"></i>Download DocKit</button>
32+
</template>
33+
<style module>
34+
.downloadButton {
35+
display: inline-block;
36+
padding: 10px;
37+
font-size: 16px;
38+
font-weight: bold;
39+
text-align: center;
40+
text-decoration: none;
41+
background-color: #87CEFA; /* Light Blue color */
42+
color: #fff;
43+
border: 1px solid #87CEFA; /* Light Blue color */
44+
border-radius: 10px; /* Rounded corners */
45+
cursor: pointer;
46+
transition: background-color 0.3s;
47+
margin-right: 10px; /* Add some space between buttons */
48+
}
49+
50+
.downloadButton:hover {
51+
background-color: #6495ED; /* Slightly darker blue on hover */
52+
}
53+
54+
.downloadButton i {
55+
margin-right: 8px; /* Adjust the space between icon and text */
56+
}
57+
</style>

docs/.vitepress/theme/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import DefaultTheme from 'vitepress/theme'
22
import {inBrowser, useData} from "vitepress";
33
import {watchEffect} from "vue";
44
import './custom.css'
5+
import Download from "./components/download.vue";
56

67
export default {
78
...DefaultTheme,
@@ -12,5 +13,9 @@ export default {
1213
document.cookie = `nf_lang=${lang.value}; expires=Mon, 1 Jan 2024 00:00:00 UTC; path=/`
1314
}
1415
})
16+
},
17+
enhanceApp({app}) {
18+
// register your custom global components
19+
app.component('Download', Download);
1520
}
1621
}

docs/download.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ outline: deep
33
---
44

55
# Download
6+
7+
<Download></Download>

0 commit comments

Comments
 (0)