From f14c206c42f6dff3913c8e5b97bfb8e06f84c42a Mon Sep 17 00:00:00 2001 From: geun <1416geun@naver.com> Date: Fri, 8 May 2026 18:52:53 +0900 Subject: [PATCH] =?UTF-8?q?=EC=84=9C=EB=B8=8C=ED=97=A4=EB=8D=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/SubLayout.jsx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/components/SubLayout.jsx b/src/components/SubLayout.jsx index ad26696..87657a0 100644 --- a/src/components/SubLayout.jsx +++ b/src/components/SubLayout.jsx @@ -1,8 +1,30 @@ +import { useEffect } from "react"; import { Outlet } from "react-router-dom"; import Header from "./Header"; import Footer from "./Footer"; function SubLayout() { + useEffect(() => { + // 서브 히어로가 다크 배경이므로 헤더 다크 모드 적용 + document.body.classList.add("is-dark-hero"); + + // 스크롤 감지 — 서브 히어로 높이(520px) 지나면 다크 해제 + const handleScroll = () => { + if (window.scrollY > 400) { + document.body.classList.remove("is-dark-hero"); + } else { + document.body.classList.add("is-dark-hero"); + } + }; + + window.addEventListener("scroll", handleScroll, { passive: true }); + + return () => { + window.removeEventListener("scroll", handleScroll); + document.body.classList.remove("is-dark-hero"); + }; + }, []); + return ( <>