feat(stock): 모바일 반응형 — 캐러셀 지표 + 스와이프 탭 + FAB

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-23 14:46:58 +09:00
parent fd13f65faa
commit e7427ff1d5
3 changed files with 110 additions and 29 deletions

View File

@@ -1,8 +1,11 @@
import React, { useEffect, useMemo, useState } from 'react';
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { Link } from 'react-router-dom';
import { getStockIndices, getStockNews, getFearAndGreed, getVix, getTreasury10Y, getWTI, getBrent } from '../../api';
import Loading from '../../components/Loading';
import FearGreedGauge from '../../components/FearGreedGauge';
import { useIsMobile } from '../../hooks/useIsMobile';
import PullToRefresh from '../../components/PullToRefresh';
import FAB from '../../components/FAB';
import './Stock.css';
const formatDate = (value) => {
@@ -109,6 +112,7 @@ const getVixLevel = (score) => {
};
const Stock = () => {
const isMobile = useIsMobile();
const [newsDomestic, setNewsDomestic] = useState([]);
const [newsOverseas, setNewsOverseas] = useState([]);
const [newsCategory, setNewsCategory] = useState('domestic');
@@ -146,6 +150,10 @@ const Stock = () => {
}
};
const handleRefresh = useCallback(async () => {
await loadNews();
}, []); // eslint-disable-line react-hooks/exhaustive-deps
const loadIndices = async () => {
setIndicesLoading(true);
setIndicesError('');
@@ -217,6 +225,7 @@ const Stock = () => {
newsCategory === 'domestic' ? newsDomestic : newsOverseas;
return (
<PullToRefresh onRefresh={handleRefresh}>
<div className="stock">
<header className="stock-header">
<div>
@@ -559,6 +568,13 @@ const Stock = () => {
)}
</section>
</div>
<FAB onClick={loadNews} label="뉴스 새로고침" icon={
<svg className="fab__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<polyline points="23 4 23 10 17 10"/>
<path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/>
</svg>
} />
</PullToRefresh>
);
};