UserToolbar.tsx
1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// REQ-USR-003: 用户列表工具栏(刷新/新增/导出Excel/设置齿轮占位,BR8/BR9/BR13/D7/D10)
import { Button } from 'antd';
import {
FileExcelOutlined,
PlusCircleOutlined,
ReloadOutlined,
SettingOutlined,
} from '@ant-design/icons';
import { TEXT_ADD, TEXT_EXPORT, TEXT_REFRESH } from './constants';
import styles from './UserList.module.css';
export interface UserToolbarProps {
onRefresh(): void;
onAdd(): void;
onExport(): void;
exporting: boolean;
loading?: boolean;
}
export default function UserToolbar({
onRefresh,
onAdd,
onExport,
exporting,
loading = false,
}: UserToolbarProps) {
return (
<div className={styles.toolbar}>
<Button
type="text"
icon={<ReloadOutlined />}
loading={loading}
onClick={() => onRefresh()}
data-testid="btn-refresh"
>
{TEXT_REFRESH}
</Button>
<Button
type="text"
icon={<PlusCircleOutlined />}
onClick={() => onAdd()}
data-testid="btn-add"
>
{TEXT_ADD}
</Button>
<Button
type="text"
icon={<FileExcelOutlined />}
loading={exporting}
disabled={exporting}
onClick={() => onExport()}
data-testid="btn-export"
>
{TEXT_EXPORT}
</Button>
<span className={styles.toolbarSpacer} />
{/* 设置齿轮:列显隐 / 偏好预留占位,无后端动作(D7) */}
<span
className={styles.gear}
data-testid="btn-gear"
role="presentation"
aria-label="设置"
>
<SettingOutlined />
</span>
</div>
);
}