diff --git a/src/components/analytics/MonthlyComparisonChart.tsx b/src/components/analytics/MonthlyComparisonChart.tsx index 7229c9b..e9afabc 100644 --- a/src/components/analytics/MonthlyComparisonChart.tsx +++ b/src/components/analytics/MonthlyComparisonChart.tsx @@ -40,7 +40,7 @@ const MonthlyComparisonChart: React.FC = ({ ); return ( -
+
{!isEmpty && monthlyData.length > 0 ? ( = ({ const isMobile = useIsMobile(); return ( -
+
diff --git a/src/hooks/use-mobile.tsx b/src/hooks/use-mobile.tsx index 2b0fe1d..4c656f3 100644 --- a/src/hooks/use-mobile.tsx +++ b/src/hooks/use-mobile.tsx @@ -1,19 +1,25 @@ + import * as React from "react" const MOBILE_BREAKPOINT = 768 export function useIsMobile() { - const [isMobile, setIsMobile] = React.useState(undefined) + const [isMobile, setIsMobile] = React.useState(false) React.useEffect(() => { - const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`) - const onChange = () => { + const checkMobile = () => { setIsMobile(window.innerWidth < MOBILE_BREAKPOINT) } - mql.addEventListener("change", onChange) - setIsMobile(window.innerWidth < MOBILE_BREAKPOINT) - return () => mql.removeEventListener("change", onChange) + + // 초기 확인 + checkMobile() + + // 리사이즈 이벤트 리스너 추가 + window.addEventListener('resize', checkMobile) + + // 클린업 함수 + return () => window.removeEventListener('resize', checkMobile) }, []) - return !!isMobile + return isMobile } diff --git a/src/index.css b/src/index.css index c4c5d75..1a156c1 100644 --- a/src/index.css +++ b/src/index.css @@ -144,6 +144,17 @@ .neuro-input { @apply neuro-pressed px-4 py-3 w-full focus:outline-none focus:ring-2 focus:ring-neuro-accent/30; } + + /* 모바일 화면에서의 추가 스타일 */ + @media (max-width: 768px) { + .neuro-card { + @apply w-full; + } + + #root { + @apply p-0; + } + } } .font-inter { diff --git a/src/pages/Analytics.tsx b/src/pages/Analytics.tsx index f7ef2eb..0cac917 100644 --- a/src/pages/Analytics.tsx +++ b/src/pages/Analytics.tsx @@ -79,7 +79,7 @@ const Analytics = () => { return (
-
+
{/* Header */}

지출 분석