|
import React, { useEffect } from 'react'; |
|
import { useTabVisibility } from '@/contexts/useTabVisibility'; |
|
|
|
interface TabContentProps { |
|
tabId: string; |
|
children: React.ReactNode; |
|
className?: string; |
|
} |
|
|
|
|
|
|
|
|
|
|
|
const TabContent: React.FC<TabContentProps> = ({ tabId, children, className = '' }) => { |
|
const { isTabVisible, setTabVisibility } = useTabVisibility(); |
|
const isVisible = isTabVisible(tabId); |
|
|
|
|
|
useEffect(() => { |
|
setTabVisibility(tabId, true); |
|
|
|
|
|
return () => { |
|
setTabVisibility(tabId, false); |
|
}; |
|
}, [tabId, setTabVisibility]); |
|
|
|
|
|
|
|
return ( |
|
<div className={`${className} ${isVisible ? '' : 'hidden'}`}> |
|
{children} |
|
</div> |
|
); |
|
}; |
|
|
|
export default TabContent; |
|
|