dify/web/app/components/app-sidebar/index.tsx

41 lines
1.1 KiB
TypeScript
Raw Normal View History

2023-05-15 08:51:32 +08:00
import React from 'react'
import type { FC } from 'react'
import NavLink from './navLink'
import AppBasic from './basic'
export type IAppDetailNavProps = {
iconType?: 'app' | 'dataset'
title: string
desc: string
2023-05-19 17:36:44 +08:00
icon: string
icon_background: string
2023-05-15 08:51:32 +08:00
navigation: Array<{
name: string
href: string
icon: any
selectedIcon: any
}>
extraInfo?: React.ReactNode
}
2023-05-19 17:36:44 +08:00
const AppDetailNav: FC<IAppDetailNavProps> = ({ title, desc, icon, icon_background, navigation, extraInfo, iconType = 'app' }) => {
2023-05-15 08:51:32 +08:00
return (
<div className="flex flex-col w-56 overflow-y-auto bg-white border-r border-gray-200 shrink-0">
<div className="flex flex-shrink-0 p-4">
2023-05-19 17:36:44 +08:00
<AppBasic iconType={iconType} icon={icon} icon_background={icon_background} name={title} type={desc} />
2023-05-15 08:51:32 +08:00
</div>
<nav className="flex-1 p-4 space-y-1 bg-white">
{navigation.map((item, index) => {
return (
<NavLink key={index} iconMap={{ selected: item.selectedIcon, normal: item.icon }} name={item.name} href={item.href} />
)
})}
{extraInfo ?? null}
</nav>
</div>
)
}
export default React.memo(AppDetailNav)