mirror of
https://github.com/EasyTier/easytier.github.io.git
synced 2025-05-19 10:27:06 +00:00
🐞 fix: follow theme switch
This commit is contained in:
@@ -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>
|
||||
Reference in New Issue
Block a user