🐞 fix: follow theme switch

This commit is contained in:
m1m1sha
2024-05-09 23:42:42 +08:00
parent 4076dc2e94
commit cf882f088e
3 changed files with 35 additions and 14 deletions
+25
View File
@@ -0,0 +1,25 @@
<script setup lang="ts">
import { useData } from 'vitepress'
import { computed } from 'vue'
const props = defineProps<{
repo: string
type?: 'Date' | 'Timeline'
}>()
const { isDark } = useData()
const url = computed(() =>
`https://star-history.com/#${props.repo}&${props.type || 'Date'}`,
)
const imgUrl = computed(() =>
`https://api.star-history.com/svg?repos=${props.repo}&type=${props.type || 'Date'}${isDark.value ? '&theme=dark' : ''}`,
)
</script>
<template>
<a :href="url">
<img alt="Star History Chart" :src="imgUrl">
</a>
</template>
+5 -7
View File
@@ -1,13 +1,11 @@
<script setup>
import StarHistory from '../../.vitepress/components/starHistory.vue'
</script>
# Community and Contribution
We welcome and encourage community contributions! If you want to get involved, please submit a [GitHub PR](https://github.com/EasyTier/EasyTier/pulls). Detailed contribution guidelines can be found in [CONTRIBUTING.md](https://github.com/EasyTier/EasyTier/blob/main/CONTRIBUTING.md).
## Star History
<a href="https://star-history.com/#EasyTier/EasyTier&Date">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=EasyTier/EasyTier&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=EasyTier/EasyTier&type=Date" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=EasyTier/EasyTier&type=Date" />
</picture>
</a>
<StarHistory repo="EasyTier/EasyTier" type="Timeline" />
+5 -7
View File
@@ -1,3 +1,7 @@
<script setup>
import StarHistory from '../.vitepress/components/starHistory.vue'
</script>
# 社区和贡献
我们欢迎并鼓励社区贡献!如果你想参与进来,请提交 [GitHub PR](https://github.com/EasyTier/EasyTier/pulls)。
@@ -6,10 +10,4 @@
## Star 历史
<a href="https://star-history.com/#EasyTier/EasyTier&Date">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=EasyTier/EasyTier&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=EasyTier/EasyTier&type=Date" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=EasyTier/EasyTier&type=Date" />
</picture>
</a>
<StarHistory repo="EasyTier/EasyTier" type="Timeline" />