feat(lotto): 모바일 반응형 — 스와이프 탭 전환
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
import { useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import BriefingTab from './tabs/BriefingTab';
|
import BriefingTab from './tabs/BriefingTab';
|
||||||
import AnalysisTab from './tabs/AnalysisTab';
|
import AnalysisTab from './tabs/AnalysisTab';
|
||||||
import PurchaseTab from './tabs/PurchaseTab';
|
import PurchaseTab from './tabs/PurchaseTab';
|
||||||
|
import { useIsMobile } from '../../hooks/useIsMobile';
|
||||||
|
import SwipeableView from '../../components/SwipeableView';
|
||||||
|
|
||||||
const TABS = [
|
const TABS = [
|
||||||
{ id: 'briefing', label: '🗓 이번 주 브리핑' },
|
{ id: 'briefing', label: '🗓 이번 주 브리핑' },
|
||||||
@@ -11,8 +13,28 @@ const TABS = [
|
|||||||
|
|
||||||
export default function Functions() {
|
export default function Functions() {
|
||||||
const [tab, setTab] = useState('briefing');
|
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 (
|
return (
|
||||||
<div className="lotto-functions">
|
<div className="lotto-functions">
|
||||||
|
{isMobile ? (
|
||||||
|
<SwipeableView
|
||||||
|
tabs={TABS.map(t => ({
|
||||||
|
key: t.id,
|
||||||
|
label: t.label,
|
||||||
|
content: t.id === 'briefing' ? <BriefingTab /> : t.id === 'analysis' ? <AnalysisTab /> : <PurchaseTab />,
|
||||||
|
}))}
|
||||||
|
activeIndex={tabIndex}
|
||||||
|
onTabChange={handleTabChange}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
<nav className="lotto-tabs">
|
<nav className="lotto-tabs">
|
||||||
{TABS.map(t => (
|
{TABS.map(t => (
|
||||||
<button
|
<button
|
||||||
@@ -27,6 +49,8 @@ export default function Functions() {
|
|||||||
{tab === 'analysis' && <AnalysisTab />}
|
{tab === 'analysis' && <AnalysisTab />}
|
||||||
{tab === 'purchase' && <PurchaseTab />}
|
{tab === 'purchase' && <PurchaseTab />}
|
||||||
</div>
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1513,4 +1513,16 @@
|
|||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.lotto-tabs { overflow-x: auto; }
|
.lotto-tabs { overflow-x: auto; }
|
||||||
.lotto-tabs button { white-space: nowrap; }
|
.lotto-tabs button { white-space: nowrap; }
|
||||||
|
|
||||||
|
/* 구매 이력 테이블 가로 스크롤 */
|
||||||
|
.purchase-list {
|
||||||
|
overflow-x: auto;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lotto-ball {
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user