Skip to content

Commit c64d521

Browse files
committed
refactor(theme-yun): unify nav menu glassmorphism styles with CSS variables
- Extract nav bg color and blur as CSS variables (--yun-nav-bg-color, --yun-nav-blur) - Add light/dark mode defaults in css-vars.scss - Replace hardcoded shadow in Nimbo .play with UnoCSS shadow class - Simplify Nimbo .play styles: remove redundant top/left/right, unused border-color and box-shadow - Replace transition: all with explicit property list for better performance - Add scoped styles to Strato nav menu for consistent glassmorphism effect - Reduce home layout bottom padding (pb-8 → pb-4)
1 parent 8bd2f77 commit c64d521

File tree

4 files changed

+27
-14
lines changed

4 files changed

+27
-14
lines changed

packages/valaxy-theme-yun/components/theme/nimbo/YunNimboNavMenu.vue

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const app = useAppStore()
4747
v-if="showMenu"
4848
class="yun-nav-menu z-$yun-z-nav-menu fixed bg-transparent"
4949
:class="{
50-
play: playAnimation,
50+
'shadow play': playAnimation,
5151
}"
5252
>
5353
<!-- -->
@@ -113,7 +113,6 @@ const app = useAppStore()
113113
// safari not support
114114
// animation-timeline: scroll();
115115
// animation-range: 0 calc(30vh), exit;
116-
box-shadow: none;
117116
display: flex;
118117
119118
// top: var(--rect-margin);
@@ -126,19 +125,14 @@ const app = useAppStore()
126125
align-items: center;
127126
justify-content: space-between;
128127
height: var(--yun-nav-height, 50px);
129-
transition: all var(--va-transition-duration-moderate) map.get($cubic-bezier, 'ease-in');
128+
transition: background-color var(--va-transition-duration-moderate) map.get($cubic-bezier, 'ease-in'),
129+
backdrop-filter var(--va-transition-duration-moderate) map.get($cubic-bezier, 'ease-in'),
130+
box-shadow var(--va-transition-duration-moderate) map.get($cubic-bezier, 'ease-in');
130131
131132
&.play {
132-
top: 0;
133-
left: 0;
134-
right: 0;
135-
background-color: var(--va-c-bg);
136-
border-color: rgb(0 0 0 / 0.1);
137-
138-
--un-shadow: var(--un-shadow-inset) 0 20px 25px -5px var(--un-shadow-color, rgb(0 0 0 / 0.1)), var(--un-shadow-inset) 0 8px 10px -6px var(--un-shadow-color, rgb(0 0 0 / 0.1));
139-
140-
box-shadow: var(--un-ring-offset-shadow), var(--un-ring-shadow),
141-
var(--un-shadow);
133+
background-color: var(--yun-nav-bg-color);
134+
backdrop-filter: blur(var(--yun-nav-blur));
135+
-webkit-backdrop-filter: blur(var(--yun-nav-blur));
142136
}
143137
144138
.vt-hamburger-top, .vt-hamburger-middle, .vt-hamburger-bottom {

packages/valaxy-theme-yun/components/theme/strato/YunStratoNavMenu.vue

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,19 @@ const isHomePage = computed(() => route.meta.layout === 'home')
8787
</div>
8888
</Transition>
8989
</template>
90+
91+
<style lang="scss" scoped>
92+
@use 'sass:map';
93+
@use 'valaxy-theme-yun/styles/vars.scss' as *;
94+
95+
.yun-nav-menu {
96+
height: var(--yun-nav-height, 50px);
97+
transition: all var(--va-transition-duration-moderate) map.get($cubic-bezier, 'ease-in');
98+
99+
&.play {
100+
background-color: var(--yun-nav-bg-color);
101+
backdrop-filter: blur(var(--yun-nav-blur));
102+
-webkit-backdrop-filter: blur(var(--yun-nav-blur));
103+
}
104+
}
105+
</style>

packages/valaxy-theme-yun/layouts/home.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const showNotice = computed(() => {
1919

2020
<template>
2121
<YunLayoutWrapper :no-margin="!isPage">
22-
<div class="w-full flex flex-col items-center pb-8">
22+
<div class="w-full flex flex-col items-center pb-4">
2323
<template v-if="themeConfig.banner?.enable">
2424
<template v-if="!isPage">
2525
<div class="w-full">

packages/valaxy-theme-yun/styles/css-vars.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
--yun-home-hero-name-background: linear-gradient(120deg, var(--va-c-text) 30%, black);
1010
--yun-home-hero-image-background-image: linear-gradient(-45deg, #bd34fe 50%, #47caff 50%);
1111
--yun-nav-height: 50px;
12+
--yun-nav-bg-color: rgb(255 255 255 / 0.8);
13+
--yun-nav-blur: 12px;
1214
}
1315

1416
:root {
@@ -31,6 +33,7 @@ html.dark {
3133
--va-c-bg: #1a1a1d;
3234
--va-c-bg-soft: #121215;
3335
--yun-home-hero-name-background: linear-gradient(120deg, var(--va-c-primary) 30%, #41d1ff);
36+
--yun-nav-bg-color: rgb(26 26 29 / 0.8);
3437
}
3538

3639
// animation

0 commit comments

Comments
 (0)