import type { FC, ReactNode } from 'react' import type { InspectHeaderProps } from './inspect-layout' import { useState } from 'react' import { cn } from '@/utils/classnames' import { useStore } from '../store' import TabHeader from './tab-header' export type SplitRightProps = { isNarrow: boolean onOpenMenu: () => void onClose: () => void } type SplitPanelProps = InspectHeaderProps & { left: ReactNode children: (rightProps: SplitRightProps) => ReactNode } const SplitPanel: FC = ({ activeTab, onTabChange, onClose, headerActions, left, children, }) => { const bottomPanelWidth = useStore(s => s.bottomPanelWidth) const isNarrow = bottomPanelWidth < 488 const [showLeftPanel, setShowLeftPanel] = useState(true) return (
{headerActions}
{isNarrow && showLeftPanel && (
setShowLeftPanel(false)} /> )}
{left}
{children({ isNarrow, onOpenMenu: () => setShowLeftPanel(true), onClose })}
) } export default SplitPanel