Skip to content

Commit

Permalink
fix(theme-yun): allow custom site-name class, close #503
Browse files Browse the repository at this point in the history
  • Loading branch information
YunYouJun committed Feb 16, 2025
1 parent ae518d7 commit 4d5b946
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions demo/yun/theme.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default defineThemeConfig({
banner: {
enable: true,
title: '云游君的小站',
siteNameClass: 'bg-gradient-to-r gradient-text from-#1e3c72 to-dark dark:from-#66a6ff dark:to-blue-500',
},

notice: {
Expand Down
16 changes: 12 additions & 4 deletions packages/valaxy-theme-yun/components/site/YunSiteTitle.vue
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
<script setup lang="ts">
import { useSiteConfig } from 'valaxy'
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import { useThemeConfig } from '../../composables'
const router = useRouter()
const siteConfig = useSiteConfig()
const themeConfig = useThemeConfig()
const classes = ref('site-name text-lg leading-loose bg-gradient-to-r gradient-text from-#1e3c72 to-dark dark:(from-#66a6ff to-blue-500)')
// bg-gradient-to-r gradient-text from-#1e3c72 to-dark dark:(from-#66a6ff to-blue-500)
</script>

<template>
<RouterLink
v-if="router.hasRoute('/about/site')" to="/about/site"
:class="classes"
class="site-name text-lg leading-loose"
:class="themeConfig.banner.siteNameClass"
>
{{ siteConfig.title }}
</RouterLink>
<span v-else :class="classes">{{ siteConfig.title }}</span>
<span
v-else
class="site-name text-lg leading-loose"
:class="themeConfig.banner.siteNameClass"
>
{{ siteConfig.title }}
</span>
</template>

<style lang="scss">
Expand Down
5 changes: 5 additions & 0 deletions packages/valaxy-theme-yun/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ export namespace YunTheme {
cloud?: {
enable: boolean
}

/**
* site-name class
*/
siteNameClass?: string
}
}

Expand Down

1 comment on commit 4d5b946

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Published on https://yun.valaxy.site as production
🚀 Deployed on https://67b1ad431b37a7152a7cb610--valaxy.netlify.app

Please sign in to comment.