dify/web/app/components/workflow/variable-inspect/inspect-layout.tsx
yyh 0b6522df42
refactor(web): extract split layout for variable inspect
- add SplitPanel to share left/right shell and narrow menu handling
- reuse InspectHeaderProps for tab header + actions across tabs
- refactor variables/artifacts tabs to plug into shared split layout
- align right-side header/close behavior and consolidate empty/loading flows
2026-01-28 14:06:34 +08:00

45 lines
1.1 KiB
TypeScript

import type { FC, ReactNode } from 'react'
import type { InspectTab } from './types'
import { RiCloseLine } from '@remixicon/react'
import ActionButton from '@/app/components/base/action-button'
import TabHeader from './tab-header'
export type InspectHeaderProps = {
activeTab: InspectTab
onTabChange: (tab: InspectTab) => void
onClose: () => void
headerActions?: ReactNode
}
type InspectLayoutProps = InspectHeaderProps & {
children: ReactNode
}
const InspectLayout: FC<InspectLayoutProps> = ({
activeTab,
onTabChange,
onClose,
headerActions,
children,
}) => {
return (
<div className="flex h-full flex-col">
<div className="flex shrink-0 items-center justify-between">
<TabHeader activeTab={activeTab} onTabChange={onTabChange}>
{headerActions}
</TabHeader>
<div className="pr-2 pt-2">
<ActionButton onClick={onClose} aria-label="Close">
<RiCloseLine className="h-4 w-4" />
</ActionButton>
</div>
</div>
<div className="flex min-h-0 flex-1 flex-col">
{children}
</div>
</div>
)
}
export default InspectLayout