mirror of https://github.com/msgbyte/tailchat
feat: 增加导航栏相关的插件面板注册
parent
056d185deb
commit
53b7195141
@ -0,0 +1,27 @@
|
||||
import type { PluginCustomPanel } from '@/plugin/common';
|
||||
import clsx from 'clsx';
|
||||
import React from 'react';
|
||||
import { Icon } from 'tailchat-design';
|
||||
import { NavbarNavItem } from './NavItem';
|
||||
|
||||
/**
|
||||
* 导航栏自定义选项
|
||||
* 用于插件
|
||||
*/
|
||||
export const NavbarCustomNavItem: React.FC<{
|
||||
panelInfo: PluginCustomPanel;
|
||||
withBg: boolean;
|
||||
}> = React.memo(({ panelInfo, withBg }) => {
|
||||
return (
|
||||
<NavbarNavItem
|
||||
key={panelInfo.name}
|
||||
name={panelInfo.label}
|
||||
className={clsx({ 'bg-gray-700': withBg })}
|
||||
to={`/main/custom/${panelInfo.name}`}
|
||||
data-testid={`navbar-custom-${panelInfo.name}`}
|
||||
>
|
||||
<Icon className="text-3xl text-white" icon={panelInfo.icon} />
|
||||
</NavbarNavItem>
|
||||
);
|
||||
});
|
||||
NavbarCustomNavItem.displayName = 'NavbarCustomNavItem';
|
Loading…
Reference in New Issue