Skip to content

Commit 0cda1b5

Browse files
committed
fix sider
1 parent d5cdacf commit 0cda1b5

File tree

1 file changed

+71
-68
lines changed

1 file changed

+71
-68
lines changed

src/components/sider.tsx

Lines changed: 71 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ interface SiderMenuProps {
2929
selectedKeys: string[];
3030
}
3131

32-
interface Style {
33-
sider: React.CSSProperties;
34-
}
35-
3632
function addApp() {
3733
let name = "";
3834
let platform = "android";
@@ -97,6 +93,10 @@ function addApp() {
9793
});
9894
}
9995

96+
const style = {
97+
sider: { boxShadow: "2px 0 8px 0 rgb(29 35 41 / 5%)", zIndex: 2 },
98+
};
99+
100100
export default function Sider() {
101101
const { pathname } = useLocation();
102102
const { user } = useUserInfo();
@@ -112,7 +112,12 @@ export default function Sider() {
112112
}
113113
}
114114
return (
115-
<Layout.Sider width={240} theme="light" style={style.sider}>
115+
<Layout.Sider
116+
className="[&>.ant-layout-sider-children]:flex [&>.ant-layout-sider-children]:flex-col!"
117+
width={240}
118+
theme="light"
119+
style={style.sider}
120+
>
116121
<Layout.Header className="flex justify-center items-center bg-transparent! px-0!">
117122
<LogoH />
118123
</Layout.Header>
@@ -130,7 +135,7 @@ const SiderMenu = ({ selectedKeys }: SiderMenuProps) => {
130135
const percent =
131136
pvQuota && consumedQuota ? (consumedQuota / pvQuota) * 100 : undefined;
132137
return (
133-
<div>
138+
<div className="flex flex-col h-full overflow-hidden">
134139
{percent && (
135140
<Card
136141
title={
@@ -174,70 +179,68 @@ const SiderMenu = ({ selectedKeys }: SiderMenuProps) => {
174179
)}
175180
</Card>
176181
)}
177-
<Menu
178-
defaultOpenKeys={["apps"]}
179-
selectedKeys={selectedKeys}
180-
mode="inline"
181-
items={[
182-
{
183-
key: "user",
184-
icon: <UserOutlined />,
185-
label: <Link to={rootRouterPath.user}>账户设置</Link>,
186-
},
187-
{
188-
key: "apps",
189-
icon: <AppstoreOutlined />,
190-
label: "应用管理",
191-
children: [
192-
...(apps?.map((i) => ({
193-
key: i.id,
194-
className: "!h-16",
195-
label: (
196-
<div className="flex flex-row items-center gap-4">
197-
<div className="flex flex-col justify-center">
198-
<PlatformIcon
199-
platform={i.platform}
200-
className="!text-xl"
201-
/>
202-
</div>
203-
<Link
204-
to={`/apps/${i.id}`}
205-
className="flex flex-col h-16 justify-center"
206-
>
207-
<div className="flex flex-row items-center font-bold">
208-
{i.name}
209-
{i.status === "paused" && (
210-
<Tag className="ml-2">暂停</Tag>
211-
)}
182+
<div className="overflow-y-auto">
183+
<Menu
184+
defaultOpenKeys={["apps"]}
185+
selectedKeys={selectedKeys}
186+
mode="inline"
187+
items={[
188+
{
189+
key: "user",
190+
icon: <UserOutlined />,
191+
label: <Link to={rootRouterPath.user}>账户设置</Link>,
192+
},
193+
{
194+
key: "apps",
195+
icon: <AppstoreOutlined />,
196+
label: "应用管理",
197+
children: [
198+
...(apps?.map((i, index) => ({
199+
key: `${i.id}-${index}`,
200+
className: "!h-16",
201+
label: (
202+
<div className="flex flex-row items-center gap-4">
203+
<div className="flex flex-col justify-center">
204+
<PlatformIcon
205+
platform={i.platform}
206+
className="text-xl!"
207+
/>
212208
</div>
213-
{i.checkCount && (
214-
<div className="text-xs text-gray-500 mb-2">
215-
<Tooltip
216-
mouseEnterDelay={1}
217-
title="今日此应用查询热更的次数"
218-
>
219-
<a>{i.checkCount.toLocaleString()}</a>
220-
</Tooltip>
209+
<Link
210+
to={`/apps/${i.id}`}
211+
className="flex flex-col h-16 justify-center"
212+
>
213+
<div className="flex flex-row items-center font-bold">
214+
{i.name}
215+
{i.status === "paused" && (
216+
<Tag className="ml-2">暂停</Tag>
217+
)}
221218
</div>
222-
)}
223-
</Link>
224-
</div>
225-
),
226-
})) || []),
227-
{
228-
key: "add-app",
229-
icon: <PlusOutlined />,
230-
label: "添加应用",
231-
onClick: addApp,
232-
},
233-
],
234-
},
235-
]}
236-
/>
219+
{i.checkCount && (
220+
<div className="text-xs text-gray-500 mb-2">
221+
<Tooltip
222+
mouseEnterDelay={1}
223+
title="今日此应用查询热更的次数"
224+
>
225+
<a>{i.checkCount.toLocaleString()}</a>
226+
</Tooltip>
227+
</div>
228+
)}
229+
</Link>
230+
</div>
231+
),
232+
})) || []),
233+
{
234+
key: "add-app",
235+
icon: <PlusOutlined />,
236+
label: "添加应用",
237+
onClick: addApp,
238+
},
239+
],
240+
},
241+
]}
242+
/>
243+
</div>
237244
</div>
238245
);
239246
};
240-
241-
const style: Style = {
242-
sider: { boxShadow: "2px 0 8px 0 rgb(29 35 41 / 5%)", zIndex: 2 },
243-
};

0 commit comments

Comments
 (0)