Skip to content

Commit 91058c3

Browse files
committed
perf: improve the shadow in the upper and lower areas when the scrolling area is scrolling,close #20, close #26
1 parent e441d14 commit 91058c3

File tree

4 files changed

+38
-15
lines changed

4 files changed

+38
-15
lines changed

packages/@core/ui-kit/layout-ui/src/components/layout-sidebar.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,10 @@ const hiddenSideStyle = computed((): CSSProperties => {
118118
});
119119
120120
const style = computed((): CSSProperties => {
121-
const { isSidebarMixed, paddingTop, zIndex } = props;
121+
const { isSidebarMixed, paddingTop, theme, zIndex } = props;
122122
123123
return {
124+
'--scroll-shadow': theme === 'dark' ? 'var(--menu-dark)' : 'var(--menu)',
124125
...calcMenuWidthStyle(false),
125126
paddingTop: `${paddingTop}px`,
126127
zIndex,

packages/@core/ui-kit/shadcn-ui/src/components/scrollbar/scrollbar.vue

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,40 @@ function handleScroll(event: Event) {
2828

2929
<template>
3030
<ScrollArea
31-
:class="[
32-
cn(props.class),
33-
{
34-
// 'shadow-none': isAtTop && isAtBottom,
35-
// shadow: !isAtTop || !isAtBottom,
36-
// 'dark:shadow-white/20': !isAtTop || !isAtBottom,
37-
// 'shadow-inner': !isAtBottom,
38-
// 'dark:shadow-inner-white/20': !isAtBottom,
39-
},
40-
]"
31+
:class="[cn(props.class)]"
4132
:on-scroll="handleScroll"
33+
class="relative"
4234
>
35+
<div
36+
:class="{
37+
'opacity-100': !isAtTop,
38+
}"
39+
class="scrollbar-top-shadow pointer-events-none absolute top-0 z-10 h-16 w-full opacity-0 transition-opacity duration-1000 ease-in-out will-change-[opacity]"
40+
></div>
4341
<slot></slot>
42+
<div
43+
:class="{
44+
'opacity-100': !isAtTop && !isAtBottom,
45+
}"
46+
class="scrollbar-bottom-shadow pointer-events-none absolute bottom-0 z-10 h-16 w-full opacity-0 transition-opacity duration-1000 ease-in-out will-change-[opacity]"
47+
></div>
4448
</ScrollArea>
4549
</template>
50+
51+
<style scoped>
52+
.scrollbar-top-shadow {
53+
background: linear-gradient(
54+
to bottom,
55+
hsl(var(--scroll-shadow, var(--background))),
56+
transparent
57+
);
58+
}
59+
60+
.scrollbar-bottom-shadow {
61+
background: linear-gradient(
62+
to top,
63+
hsl(var(--scroll-shadow, var(--background))),
64+
transparent
65+
);
66+
}
67+
</style>

packages/effects/layouts/src/widgets/preferences/blocks/theme/theme.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ defineOptions({
1717
});
1818
1919
const modelValue = defineModel<string>({ default: 'auto' });
20-
const appSemiDarkMenu = defineModel<boolean>('appSemiDarkMenu', {
20+
const themeSemiDarkMenu = defineModel<boolean>('themeSemiDarkMenu', {
2121
default: true,
2222
});
2323
@@ -75,7 +75,7 @@ function nameView(name: string) {
7575
</template>
7676

7777
<SwitchItem
78-
v-model="appSemiDarkMenu"
78+
v-model="themeSemiDarkMenu"
7979
:disabled="modelValue !== 'light'"
8080
class="mt-6"
8181
>

packages/effects/layouts/src/widgets/preferences/preferences-sheet.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ const appDynamicTitle = defineModel<boolean>('appDynamicTitle');
6161
const appLayout = defineModel<LayoutType>('appLayout');
6262
const appColorGrayMode = defineModel<boolean>('appColorGrayMode');
6363
const appColorWeakMode = defineModel<boolean>('appColorWeakMode');
64-
const appSemiDarkMenu = defineModel<boolean>('appSemiDarkMenu');
6564
const appContentCompact = defineModel<ContentCompactType>('appContentCompact');
6665
6766
const transitionProgress = defineModel<boolean>('transitionProgress');
@@ -73,6 +72,7 @@ const themeColorPrimary = defineModel<string>('themeColorPrimary');
7372
const themeBuiltinType = defineModel<BuiltinThemeType>('themeBuiltinType');
7473
const themeMode = defineModel<ThemeModeType>('themeMode');
7574
const themeRadius = defineModel<string>('themeRadius');
75+
const themeSemiDarkMenu = defineModel<boolean>('themeSemiDarkMenu');
7676
7777
const sidebarEnable = defineModel<boolean>('sidebarEnable');
7878
const sidebarWidth = defineModel<number>('sidebarWidth');
@@ -269,7 +269,7 @@ async function handleReset() {
269269
<Block :title="$t('preferences.theme.title')">
270270
<Theme
271271
v-model="themeMode"
272-
v-model:app-semi-dark-menu="appSemiDarkMenu"
272+
v-model:theme-semi-dark-menu="themeSemiDarkMenu"
273273
/>
274274
</Block>
275275
<!-- <Block :title="$t('preferences.theme-color')">

0 commit comments

Comments
 (0)