Skip to content

Commit d4d8577

Browse files
committed
Docs - add stats on home
1 parent 4924188 commit d4d8577

File tree

5 files changed

+1970
-1026
lines changed

5 files changed

+1970
-1026
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<script setup lang="ts">
2+
import { reactive, onMounted } from 'vue'
3+
import VPButton from 'vitepress/dist/client/theme-default/components/VPButton.vue'
4+
5+
const stats = reactive({
6+
github: '--',
7+
packagist: '--',
8+
});
9+
10+
onMounted(() => {
11+
fetch("https://packagist.org/packages/makinacorpus/db-tools-bundle.json")
12+
.then(raw => raw.json())
13+
.then(data => {
14+
stats.packagist = data.package.downloads.monthly
15+
stats.github = data.package.github_stars
16+
});
17+
});
18+
19+
</script>
20+
21+
<template>
22+
<div class="actions">
23+
<div class="action">
24+
<VPButton
25+
tag="a"
26+
size="medium"
27+
theme="brand"
28+
text="Get Started"
29+
href="./getting-started/introduction"
30+
/>
31+
</div>
32+
<div class="action">
33+
<VPButton
34+
tag="a"
35+
size="medium"
36+
theme="alt"
37+
text="View on GitHub"
38+
href="https://github.com/makinacorpus/DbToolsBundle"
39+
/>
40+
<small>{{ stats.github }} ⭐</small>
41+
42+
</div>
43+
<div class="action">
44+
<VPButton
45+
tag="a"
46+
size="medium"
47+
theme="alt"
48+
text="View on packagist"
49+
href="https://packagist.org/packages/makinacorpus/db-tools-bundle"
50+
/>
51+
<small>{{ stats.packagist }} installs/month</small>
52+
</div>
53+
</div>
54+
</template>
55+
56+
<style scoped>
57+
.actions {
58+
display: flex;
59+
flex-wrap: wrap;
60+
margin: -6px;
61+
padding-top: 24px;
62+
}
63+
64+
.actions small {
65+
margin-top: -5px;
66+
}
67+
68+
@media (min-width: 640px) {
69+
.actions {
70+
padding-top: 32px;
71+
}
72+
}
73+
74+
@media (min-width: 960px) {
75+
.VPHero.has-image .actions {
76+
justify-content: flex-start;
77+
}
78+
}
79+
80+
.action {
81+
flex-shrink: 0;
82+
padding: 6px;
83+
display: flex;
84+
flex-direction: column;
85+
justify-content: start;
86+
align-items: center;
87+
gap: 0.4rem;
88+
}
89+
</style>

docs/.vitepress/theme/custom.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
--vp-c-brand-lighter: #a279e0;
88
--vp-c-brand-dark: #221157;
99
--vp-c-brand-darker: #221157;
10+
--vp-button-brand-bg: var(--vp-c-brand);
11+
--vp-button-brand-hover-bg: var(--vp-c-brand-dark);
1012
--vp-c-text-code: #221157;
1113
--vp-button-brand-border: transparent;
1214
--vp-button-brand-hover-border: transparent;

docs/.vitepress/theme/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@ import './custom.css'
44
import MakinaCorpusHorizontal from './MakinaCorpusHorizontal.vue'
55
import MakinaCorpusSquare from './MakinaCorpusSquare.vue'
66
import { h } from 'vue'
7+
import DbToolsBundleActions from './DbToolsBundleActions.vue'
78

89
export default {
9-
...DefaultTheme,
10+
extends: DefaultTheme,
1011
Layout() {
1112
return h(DefaultTheme.Layout, null, {
1213
'aside-bottom': () => h(MakinaCorpusSquare),
1314
'home-features-after': () => h(MakinaCorpusHorizontal),
15+
'home-hero-actions-after': () => h(DbToolsBundleActions)
1416
})
15-
}
17+
},
18+
VPHomeHero: DbToolsBundleActions,
1619
}

docs/content/index.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,6 @@ hero:
88
light: ./logo.svg
99
dark: ./logo-d.svg
1010
alt: DbToolsBundle by Makina Corpus
11-
actions:
12-
- theme: brand
13-
text: Get Started
14-
link: ./getting-started/introduction
15-
- theme: alt
16-
text: View on GitHub
17-
link: https://github.com/makinacorpus/DbToolsBundle
18-
- theme: alt
19-
text: View on Packagist
20-
link: https://packagist.org/packages/makinacorpus/db-tools-bundle
2111

2212
features:
2313
- icon:

0 commit comments

Comments
 (0)