import { Tabs, TabsProps } from 'antd';
import { RouteTabProps } from './types';
function RouteTab({
routes,
activeKey,
onChangeHandler,
history,
...rest
}: RouteTabProps & TabsProps): JSX.Element {
const onChange = (activeRoute: string): void => {
if (onChangeHandler) {
onChangeHandler();
}
const selectedRoute = routes.find((e) => e.key === activeRoute);
if (selectedRoute) {
history.push(selectedRoute.route);
}
};
const items = routes.map(({ Component, name, route, key }) => ({
label: name,
key,
tabKey: route,
children: ,
}));
return (
);
}
RouteTab.defaultProps = {
onChangeHandler: undefined,
};
export default RouteTab;