Skip to content

Commit b35e39d

Browse files
committed
perf: layout update
1 parent c3df76c commit b35e39d

1 file changed

Lines changed: 31 additions & 28 deletions

File tree

src/pages/zustand/index.tsx

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react'
2+
import FixTabPanel from '@stateless/FixTabPanel'
23
import { Button, Card, Statistic, Switch, Space } from 'antd'
34
import { useStore } from '@/store'
45

@@ -12,35 +13,37 @@ const ZustandDemo = () => {
1213
const toggleSidebar = useStore((state) => state.toggleSidebar)
1314

1415
return (
15-
<div className="flex flex-col gap-6 p-6">
16-
<Card title="Zustand 计数器模块 (Counter Slice)">
17-
<div className="flex items-center gap-8">
18-
<Statistic title="当前计数" value={count} />
19-
<Space>
20-
<Button type="primary" onClick={increment}>
21-
+1 (同步)
22-
</Button>
23-
<Button onClick={decrement}>-1 (同步)</Button>
24-
<Button onClick={asyncIncrement}>+1 (异步/延时)</Button>
25-
</Space>
26-
</div>
27-
</Card>
16+
<FixTabPanel>
17+
<div className="flex flex-col gap-6 p-6">
18+
<Card title="Zustand 计数器模块 (Counter Slice)">
19+
<div className="flex flex-col items-center gap-8">
20+
<Statistic title="当前计数" value={count} />
21+
<Space>
22+
<Button type="primary" onClick={increment}>
23+
+1 (同步)
24+
</Button>
25+
<Button onClick={decrement}>-1 (同步)</Button>
26+
<Button onClick={asyncIncrement}>+1 (异步/延时)</Button>
27+
</Space>
28+
</div>
29+
</Card>
2830

29-
<Card title="Zustand 全局应用模块 (App Slice)">
30-
<div className="flex items-center gap-8">
31-
<Statistic
32-
title="侧边栏状态"
33-
value={isSidebarOpen ? '开启' : '关闭'}
34-
styles={{ content: { color: isSidebarOpen ? '#3f8600' : '#cf1322' } }}
35-
/>
36-
<Space>
37-
<Switch checked={isSidebarOpen} onChange={toggleSidebar} checkedChildren="开" unCheckedChildren="关" />
38-
<Button onClick={toggleSidebar}>切换状态</Button>
39-
</Space>
40-
</div>
41-
<div className="mt-4 text-gray-500">* 此状态已配置持久化,刷新页面后状态会保持。</div>
42-
</Card>
43-
</div>
31+
<Card title="Zustand 全局应用模块 (App Slice)">
32+
<div className="flex items-center gap-8">
33+
<Statistic
34+
title="侧边栏状态"
35+
value={isSidebarOpen ? '开启' : '关闭'}
36+
styles={{ content: { color: isSidebarOpen ? '#3f8600' : '#cf1322' } }}
37+
/>
38+
<Space>
39+
<Switch checked={isSidebarOpen} onChange={toggleSidebar} checkedChildren="开" unCheckedChildren="关" />
40+
<Button onClick={toggleSidebar}>切换状态</Button>
41+
</Space>
42+
</div>
43+
<div className="mt-4 text-gray-500">* 此状态已配置持久化,刷新页面后状态会保持。</div>
44+
</Card>
45+
</div>
46+
</FixTabPanel>
4447
)
4548
}
4649

0 commit comments

Comments
 (0)