Skip to content

Commit 1daee9b

Browse files
committed
Layout: add donate button.
1 parent b6a3504 commit 1daee9b

4 files changed

Lines changed: 44 additions & 1 deletion

File tree

.vitepress/config.mts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ export default defineConfig({
1919
themeConfig: {
2020
// https://vitepress.dev/reference/default-theme-config
2121
nav: [
22+
{ component: 'VPButton', props: { type: 'secondary', text: '❤️ donate', href: 'https://boosty.to/lord-server' } },
23+
{ text: ' ', link: '' }, // spacer/divider
2224
{ text: 'Home', link: '/' },
23-
{ component: 'NavBadge', props: { type: 'tip', text: docs.voxrame.version } }
25+
{ component: 'NavBadge', props: { type: 'tip', text: docs.voxrame.version } },
2426
],
2527

2628
// Sidebar for other languages is described in their configs (es/config.ts, ru/config.ts, etc.)

.vitepress/theme/custom.pcss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
@import './styles/code-blocks.pcss';
44
@import './styles/toc.pcss';
55
@import './styles/rtl.pcss';
6+
@import './styles/fund-button.pcss';

.vitepress/theme/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,31 @@ import { NolebaseHighlightTargetedHeading } from '@nolebase/vitepress-plugin-hig
66
import '@nolebase/vitepress-plugin-highlight-targeted-heading/client/style.css'
77

88
import NavBadge from './components/NavBadge.vue'
9+
import { VPButton } from 'vitepress/theme'
910

1011
/** @type {import('vitepress').Theme} */
1112
export default {
1213
extends: DefaultTheme,
1314
enhanceApp({ app }) {
1415
app.component('NavBadge', NavBadge)
16+
app.component('VPButton', VPButton)
1517
},
1618
Layout: () => {
1719
return h(DefaultTheme.Layout, null, {
1820
// other configurations...
1921
'layout-top': () => [
2022
h(NolebaseHighlightTargetedHeading),
2123
],
24+
'nav-bar-content-before': () => [
25+
h('div', { class: 'mobile-fund-button' }, [
26+
h('a', {
27+
href: 'https://boosty.to/lord-server',
28+
class: 'VPButton secondary',
29+
target: '_blank',
30+
rel: 'noopener noreferrer'
31+
}, '❤️ donate')
32+
])
33+
],
2234
})
2335
},
2436
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
.VPNav {
3+
.VPButton {
4+
color: var(--vp-c-text-1) !important;
5+
background-color: var(--vp-c-brand-soft) !important;
6+
border-radius: 8px !important;
7+
align-self: center;
8+
}
9+
}
10+
11+
/* Mobile fund button */
12+
.mobile-fund-button {
13+
display: none;
14+
}
15+
16+
@media (max-width: 768px) {
17+
.mobile-fund-button {
18+
display: flex !important;
19+
align-items: center;
20+
margin-right: 12px;
21+
}
22+
23+
.mobile-fund-button .VPButton {
24+
padding: 6px 12px;
25+
font-size: 12px;
26+
font-weight: 600;
27+
}
28+
}

0 commit comments

Comments
 (0)