Skip to content

Commit f6483dd

Browse files
committed
perf: 优化导航栏高度不够的情况下的表现
1 parent 9090ee8 commit f6483dd

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

client/web/src/routes/Main/Navbar/index.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import { InboxNav } from './InboxNav';
88
import { InstallBtn } from './InstallBtn';
99
import { ReactQueryDevBtn } from './ReactQueryDevBtn';
1010
import { pluginCustomPanel } from '@/plugin/common';
11-
import { Icon } from 'tailchat-design';
12-
import { NavbarNavItem } from './NavItem';
1311
import { NavbarCustomNavItem } from './CustomNavItem';
1412

1513
/**
@@ -24,7 +22,7 @@ export const Navbar: React.FC = React.memo(() => {
2422
<MobileMenuBtn />
2523

2624
{/* Navbar */}
27-
<div className="flex-1 w-full">
25+
<div className="flex-1 w-full overflow-hidden flex flex-col">
2826
<div className="space-y-2">
2927
<PersonalNav />
3028

@@ -41,7 +39,10 @@ export const Navbar: React.FC = React.memo(() => {
4139
<Divider />
4240
</div>
4341

44-
<GroupNav />
42+
{/* 如果导航栏高度不够就缩减群组列表的高度 */}
43+
<div className="overflow-y-hidden hover:overflow-y-auto overflow-x-hidden thin-scrollbar">
44+
<GroupNav />
45+
</div>
4546

4647
{pluginCustomPanel
4748
.filter((p) => p.position === 'navbar-group')

client/web/tailwind.config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,20 @@ const tailchat = plugin(({ e, addUtilities }) => {
3434
pointerEvents: 'none',
3535
},
3636
},
37+
'.thin-scrollbar': {
38+
'&::-webkit-scrollbar': {
39+
width: '8px',
40+
height: '8px',
41+
},
42+
'&::-webkit-scrollbar-thumb': {
43+
borderWidth: '2px',
44+
borderRadius: '3px',
45+
},
46+
'&::-webkit-scrollbar-track': {
47+
borderWidth: '2px',
48+
borderRadius: '4px',
49+
},
50+
},
3751
};
3852

3953
addUtilities(newUtilities);
@@ -211,6 +225,7 @@ module.exports = {
211225
borderRadius: ['hover'],
212226
borderWidth: ['last'],
213227
height: ['group-hover'],
228+
overflow: ['hover'],
214229
},
215230
},
216231
plugins: [tailchat],

0 commit comments

Comments
 (0)