import { IconFolderPlus, IconMistOff, IconPlus } from '@tabler/icons-react'; import { ReactNode } from 'react'; import { useTranslation } from 'react-i18next'; import { CloseSidebarButton, OpenSidebarButton, } from './components/OpenCloseButton'; import Search from '../Search'; interface Props { isOpen: boolean; addItemButtonTitle: string; side: 'left' | 'right'; items: T[]; itemComponent: ReactNode; folderComponent: ReactNode; footerComponent?: ReactNode; searchTerm: string; handleSearchTerm: (searchTerm: string) => void; toggleOpen: () => void; handleCreateItem: () => void; handleCreateFolder: () => void; handleDrop: (e: any) => void; } const Sidebar = ({ isOpen, addItemButtonTitle, side, items, itemComponent, folderComponent, footerComponent, searchTerm, handleSearchTerm, toggleOpen, handleCreateItem, handleCreateFolder, handleDrop, }: Props) => { const { t } = useTranslation('promptbar'); const allowDrop = (e: any) => { e.preventDefault(); }; const highlightDrop = (e: any) => { e.target.style.background = '#343541'; }; const removeHighlight = (e: any) => { e.target.style.background = 'none'; }; return isOpen ? (
{items?.length > 0 && (
{folderComponent}
)} {items?.length > 0 ? (
{itemComponent}
) : (
{t('No data.')}
)}
{footerComponent}
) : ( ); }; export default Sidebar;