29 lines
754 B
TypeScript
29 lines
754 B
TypeScript
// CustomDrawerContent.tsx
|
|
import { DrawerContentScrollView } from '@react-navigation/drawer';
|
|
import React from 'react';
|
|
import { Category, categories } from '../types/Category';
|
|
import { SideMenu } from './SideMenu';
|
|
|
|
type CustomDrawerContentProps = {
|
|
selected: Category;
|
|
setSelected: (key: Category) => void;
|
|
handleLogout: () => void;
|
|
};
|
|
|
|
export function CustomDrawerContent({
|
|
selected,
|
|
setSelected,
|
|
handleLogout,
|
|
}: CustomDrawerContentProps) {
|
|
return (
|
|
<DrawerContentScrollView style={{ flex: 1, paddingTop: 0 }}>
|
|
<SideMenu
|
|
menuItems={categories.map(c => ({ key: c.key as Category, label: c.label }))}
|
|
selected={selected}
|
|
onSelect={key => setSelected(key)}
|
|
onLogout={handleLogout}
|
|
/>
|
|
</DrawerContentScrollView>
|
|
);
|
|
}
|