-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathFilesSidebar.tsx
More file actions
34 lines (30 loc) · 895 Bytes
/
FilesSidebar.tsx
File metadata and controls
34 lines (30 loc) · 895 Bytes
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
import { Menu, theme } from 'antd';
import { useTranslation } from 'react-i18next';
import { FILE_CATEGORIES, type FileCategory } from './fileCategories';
interface FilesSidebarProps {
activeCategory: FileCategory;
onSelect: (category: FileCategory) => void;
}
export function FilesSidebar({ activeCategory, onSelect }: FilesSidebarProps) {
const { token } = theme.useToken();
const { t } = useTranslation();
const items = FILE_CATEGORIES.map(({ id, labelKey, icon: Icon }) => ({
key: id,
icon: <Icon size={16} />,
label: t(labelKey),
}));
return (
<div
data-testid="files-sidebar"
className="h-full"
style={{ backgroundColor: token.colorBgContainer }}
>
<Menu
mode="inline"
selectedKeys={[activeCategory]}
items={items}
onClick={({ key }) => onSelect(key as FileCategory)}
/>
</div>
);
}