File tree 2 files changed +61
-0
lines changed
.vitepress/theme/components
2 files changed +61
-0
lines changed Original file line number Diff line number Diff line change
1
+ <script setup lang="ts">
2
+ import { computed } from ' vue'
3
+ import { VPDocAsideSponsors } from ' vitepress/theme'
4
+ import sponsors from ' ./sponsors.json'
5
+
6
+ // to avoid the never[] type in json
7
+ interface Sponsor {
8
+ alt: string
9
+ href: string
10
+ imgSrcDark: string
11
+ imgSrcLight: string
12
+ }
13
+
14
+ const asideSponsors = computed (() => {
15
+ return [
16
+ {
17
+ size: ' mini' ,
18
+ items: sponsors .platinum .length ? sponsors .platinum .map ((sponsor : Sponsor ) => ({
19
+ name: sponsor .alt ,
20
+ url: sponsor .href ,
21
+ img: sponsor .imgSrcLight ,
22
+ })) : [
23
+ {
24
+ name: ' Become a sponsor' ,
25
+ url: ' https://github.com/sponsors/posva' ,
26
+ img: ' /your-logo-here.svg'
27
+ }
28
+ ],
29
+ },
30
+ {
31
+ size: ' xmini' ,
32
+ // TODO: use gold instead once I have some
33
+ items: sponsors .silver .map ((sponsor : Sponsor ) => ({
34
+ name: sponsor .alt ,
35
+ url: sponsor .href ,
36
+ img: sponsor .imgSrcLight ,
37
+ })),
38
+ },
39
+ ]
40
+ })
41
+ </script >
42
+
1
43
<template >
44
+ <VPDocAsideSponsors :data =" asideSponsors" />
45
+
2
46
<a
3
47
class =" banner mp"
4
48
href =" https://masteringpinia.com/?utm_source=affiliate&utm_medium=vuerouter&utm_campaign=VueRouter_MP&utm_content=sidebar"
27
71
</template >
28
72
29
73
<style scoped>
74
+ .VPDocAsideSponsors {
75
+ margin-top : 8px !important ;
76
+ }
77
+
78
+ :deep(.vp-sponsor-grid.mini .vp-sponsor-grid-image ) {
79
+ max-width : 158px ;
80
+ max-height : 48px ;
81
+ }
82
+ :deep(.vp-sponsor-grid.xmini .vp-sponsor-grid-image ) {
83
+ max-width : 80px ;
84
+ max-height : 32px ;
85
+ }
86
+
30
87
.banner {
31
88
margin : 0.25rem 0 ;
32
89
padding : 0.4rem 0 ;
You can’t perform that action at this time.
0 commit comments