style: side menu scroll bar

This commit is contained in:
jialin
2026-06-02 15:18:00 +08:00
committed by jialin
parent abd0d52fad
commit b444c35643
3 changed files with 57 additions and 51 deletions
+2 -5
View File
@@ -284,10 +284,6 @@ body {
} }
} }
} }
.ant-pro-sider .ant-layout-sider-children {
// border-right: 1px solid var(--ant-color-split);
}
} }
.ant-table-content table { .ant-table-content table {
@@ -347,7 +343,6 @@ body {
.ant-pro-layout-container { .ant-pro-layout-container {
overflow-x: auto; overflow-x: auto;
min-height: 100vh; min-height: 100vh;
// background-color: var(--ant-color-bg-container);
} }
.ant-pro-sider { .ant-pro-sider {
@@ -812,6 +807,8 @@ body {
} }
.ant-pro-sider-logo + div { .ant-pro-sider-logo + div {
display: flex;
overflow: hidden;
&::-webkit-scrollbar { &::-webkit-scrollbar {
width: 0; width: 0;
} }
+1 -8
View File
@@ -21,11 +21,7 @@ import {
import { useAccessMarkedRoutes } from '@@/plugin-access'; import { useAccessMarkedRoutes } from '@@/plugin-access';
import { useModel } from '@@/plugin-model'; import { useModel } from '@@/plugin-model';
import { ProLayout } from '@ant-design/pro-components'; import { ProLayout } from '@ant-design/pro-components';
import { import { CoreUIProvider, IconFont } from '@gpustack/core-ui';
CoreUIProvider,
IconFont,
useOverlayScroller
} from '@gpustack/core-ui';
import { import {
Access, Access,
Outlet, Outlet,
@@ -135,9 +131,6 @@ const mapRoutes = (routes: IRoute[], role: string) => {
}; };
export default (props: any) => { export default (props: any) => {
const { initialize: initialize } = useOverlayScroller({
defer: false
});
const [, contextHolder] = Modal.useModal(); const [, contextHolder] = Modal.useModal();
const { themeData, setUserSettings, userSettings } = useUserSettings(); const { themeData, setUserSettings, userSettings } = useUserSettings();
const [userInfo] = useAtom(userAtom); const [userInfo] = useAtom(userAtom);
+54 -38
View File
@@ -1,5 +1,5 @@
import { CaretDownOutlined } from '@ant-design/icons'; import { CaretDownOutlined } from '@ant-design/icons';
import { IconFont } from '@gpustack/core-ui'; import { IconFont, OverlayScroller } from '@gpustack/core-ui';
import { Link, useLocation } from '@umijs/max'; import { Link, useLocation } from '@umijs/max';
import { Tooltip } from 'antd'; import { Tooltip } from 'antd';
import { createStyles, type FullToken } from 'antd-style'; import { createStyles, type FullToken } from 'antd-style';
@@ -29,12 +29,17 @@ const useStyles = createStyles(
return { return {
siderMenu: css` siderMenu: css`
width: 100%;
&.sider-menu-collapsed { &.sider-menu-collapsed {
.menu-item { .menu-item {
justify-content: center; justify-content: center;
padding: 0; padding: 0;
} }
} }
.os-scrollbar-vertical .os-scrollbar-handle {
min-width: 4px;
max-width: 4px;
}
`, `,
groupTitle: css` groupTitle: css`
display: flex; display: flex;
@@ -222,44 +227,55 @@ const SiderMenu: React.FC<SiderMenuProps> = (props) => {
'sider-menu-collapsed': collapsed 'sider-menu-collapsed': collapsed
})} })}
> >
{menuData.map((item: MenuItem, index: number) => ( <OverlayScroller
<div key={item.key}> styles={{
{item.children && item.children.length > 0 ? ( wrapper: {
<> paddingInline: 0,
<div maxHeight: '100%'
className={cx(styles.groupTitle, { }
'menu-item-group-title-collapsed': collapsed }}
})} >
onClick={(e) => handleToggleGroup(e, item)} <div>
> {menuData.map((item: MenuItem, index: number) => (
{!collapsed ? ( <div key={item.key}>
<span className="group-title-text"> {item.children && item.children.length > 0 ? (
<span>{item.name}</span> <>
<CaretDownOutlined <div
rotate={collapseKeys.has(item.key) ? -90 : 0} className={cx(styles.groupTitle, {
></CaretDownOutlined> 'menu-item-group-title-collapsed': collapsed
</span> })}
) : ( onClick={(e) => handleToggleGroup(e, item)}
<span className={styles.line}></span> >
)} {!collapsed ? (
</div> <span className="group-title-text">
<div <span>{item.name}</span>
className={cx(styles.menuItemGroup, { <CaretDownOutlined
'menu-item-group-collapsed': collapsed, rotate={collapseKeys.has(item.key) ? -90 : 0}
'menu-item-group-hidden': ></CaretDownOutlined>
!collapsed && collapseKeys.has(item.key) </span>
})} ) : (
> <span className={styles.line}></span>
{item.children?.map((child: MenuItem) => )}
menuItemRender(child, child.key) </div>
)} <div
</div> className={cx(styles.menuItemGroup, {
</> 'menu-item-group-collapsed': collapsed,
) : ( 'menu-item-group-hidden':
menuItemRender(item, item.key) !collapsed && collapseKeys.has(item.key)
)} })}
>
{item.children?.map((child: MenuItem) =>
menuItemRender(child, child.key)
)}
</div>
</>
) : (
menuItemRender(item, item.key)
)}
</div>
))}
</div> </div>
))} </OverlayScroller>
</div> </div>
); );
}; };