import { useCallback, useState } from 'react'; import BriefingTab from './tabs/BriefingTab'; import AnalysisTab from './tabs/AnalysisTab'; import PurchaseTab from './tabs/PurchaseTab'; import { useIsMobile } from '../../hooks/useIsMobile'; import SwipeableView from '../../components/SwipeableView'; const TABS = [ { id: 'briefing', label: '🗓 이번 주 브리핑' }, { id: 'analysis', label: '📚 자료실 / Deep Dive' }, { id: 'purchase', label: '💰 구매·성과' }, ]; export default function Functions() { const [tab, setTab] = useState('briefing'); const isMobile = useIsMobile(); const tabIndex = TABS.findIndex(t => t.id === tab); const handleTabChange = useCallback((index) => { setTab(TABS[index].id); }, []); return (
{isMobile ? ( ({ key: t.id, label: t.label, content: t.id === 'briefing' ? : t.id === 'analysis' ? : , }))} activeIndex={tabIndex} onTabChange={handleTabChange} /> ) : ( <>
{tab === 'briefing' && } {tab === 'analysis' && } {tab === 'purchase' && }
)}
); }