Skip to content

Commit

Permalink
feat(theme-yun): add gradient text title
Browse files Browse the repository at this point in the history
  • Loading branch information
YunYouJun committed Dec 13, 2024
1 parent 4b2d2af commit e5b1c2e
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 22 deletions.
2 changes: 1 addition & 1 deletion packages/valaxy-theme-yun/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const isDev = import.meta.env.DEV
<YunPageHeaderGradient />
<YunNavMenu />

<YunFullscreenMenu v-if="yun.isNimbo" />
<YunFullscreenMenu v-if="yun.isNimbo && !yun.size.isSm" />
<YunStratoSidebar v-if="yun.isStrato" />

<YunFireworks v-if="themeConfig.fireworks.enable" />
Expand Down
22 changes: 8 additions & 14 deletions packages/valaxy-theme-yun/components/YunFullscreenMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,18 @@ const app = useAppStore()
<YunToggleLocale v-if="app.showToggleLocale" />
</div> -->

<div v-if="!yunApp.size.isLg">
<YunSiteInfo class="text-center" />

<YunGradientDivider class="my-2 op-20" />

<YunPostsInfo />
</div>

<YunGradientDivider v-if="!yunApp.size.isLg" class="my-2 op-20" />

<!-- <YunFullscreenMenuList /> -->
<YunSiteInfo class="text-center" />
<YunGradientDivider class="my-2 op-20" />
<YunPostsInfo />
<YunGradientDivider class="my-2 op-20" />
<YunSocialLinks />
<YunGradientDivider class="my-2 op-20" />
<YunSidebarLinks />

<YunGradientDivider v-if="!yunApp.size.isLg" class="my-2 op-20" />

<YunFullscreenMenuList />

<YunGradientDivider v-if="!yunApp.size.isLg" class="my-2 op-20" />
<div v-if="!yunApp.size.isLg" class="flex-center">
<div class="flex-center">
<YunConfig />
</div>
</div>
Expand Down
18 changes: 15 additions & 3 deletions packages/valaxy-theme-yun/components/YunPostCard.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts" setup>
import type { Post } from 'valaxy'
import { computed, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { usePostProperty } from '../composables'
Expand All @@ -9,7 +10,15 @@ const props = defineProps<{
const { t } = useI18n()
const { icon, styles } = usePostProperty(props.post.type)
const { icon, styles, color } = usePostProperty(props.post.type)
const gradientClasses = ref('bg-gradient-to-r gradient-text from-$va-c-primary to-$va-c-primary-lighter')
const postTitleClass = computed(() => {
if (color) {
return ''
}
return props.post.postTitleClass || gradientClasses.value
})
</script>

<template>
Expand All @@ -35,9 +44,12 @@ const { icon, styles } = usePostProperty(props.post.type)
class="post-title-link cursor-pointer"
:to="post.path || ''"
m="t-3"
:class="post.postTitleClass"
:class="postTitleClass"
>
<div class="flex-center title text-2xl" text="center" font="serif black">
<div
class="flex-center title text-2xl"
text="center" font="serif black"
>
<div v-if="post.type" class="inline-flex" m="r-1" :class="icon" />
<span>{{ post.title }}</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/valaxy-theme-yun/components/site/YunSiteTitle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useRouter } from 'vue-router'
const router = useRouter()
const siteConfig = useSiteConfig()
const classes = ref('site-name clip text-lg leading-loose bg-gradient-to-r gradient-text from-#1e3c72 to-dark dark:(from-#66a6ff to-blue-500)')
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)')
</script>

<template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const app = useAppStore()
<!-- -->
<div class="inline-flex justify-start items-center flex-1">
<ValaxyHamburger
v-if="!yunApp.size.isMd"
v-if="!yunApp.size.isSm"
:active="yunApp.fullscreenMenu.isOpen"
class="menu-btn sidebar-toggle leading-4 size-12"
inline-flex cursor="pointer"
Expand All @@ -57,7 +57,7 @@ const app = useAppStore()
@click="yunApp.fullscreenMenu.toggle()"
/>
<YunNavMenuItem icon="i-ri-home-4-line" to="/" />
<template v-if="yunApp.size.isMd">
<template v-if="yunApp.size.isSm">
<YunNavMenuItem
icon="i-ri-article-line" to="/posts/"
title="博客文章"
Expand Down
2 changes: 1 addition & 1 deletion packages/valaxy/node/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function createServer(
serverSpinner.text = getServerInfoText('init vite plugins ..')
const plugins = await ViteValaxyPlugins(valaxyApp, serverOptions)
// dynamic import to avoid bundle it in build
const enableDevtools = options.mode === 'dev' && options.config.devtools
const enableDevtools = options.config.devtools
const vitePlugins = [
...plugins,
]
Expand Down

0 comments on commit e5b1c2e

Please sign in to comment.