/* app.jsx — 다힘 홈페이지 v2 */
const { useEffect: useEffect2, useState: useStateA, useRef: useRefA } = React;
const NAV = [
{ href: "greetings.php", label: "원장 인사말" },
{ href: "results.php", label: "학원 실적" },
{ href: "curriculum.php", label: "시스템 소개" },
{ href: "ai_system.php", label: "다힘AI 시스템", ai: true },
{
label: "커리큘럼",
children: [
{ href: "curriculum_elem.php", title: "초등부", sub: "독서·문해력 기초 · 초1~초6", icon: "elem" },
{ href: "curriculum_middle.php", title: "중등부", sub: "3-Step · 중1~중3", icon: "mid" },
{ href: "curriculum_high.php", title: "고등부", sub: "1등급 사수 + 입시 · 고1~고3", icon: "high" },
],
},
{ href: "notice.php", label: "공지사항" },
{ href: "contact.php", label: "오시는 길" },
];
const DDIcon = ({ kind }) => {
if (kind === "elem") return ;
if (kind === "mid") return ;
if (kind === "high") return ;
return null;
};
const Nav = () => {
const [openIdx, setOpenIdx] = useStateA(-1);
const [scrolled, setScrolled] = useStateA(false);
const closeTimer = useRefA(null);
useEffect2(() => {
const on = () => setScrolled(window.scrollY > 8);
on();
window.addEventListener("scroll", on, { passive: true });
return () => window.removeEventListener("scroll", on);
}, []);
const enter = (i) => {
if (closeTimer.current) clearTimeout(closeTimer.current);
setOpenIdx(i);
};
const leave = () => {
closeTimer.current = setTimeout(() => setOpenIdx(-1), 160);
};
return (
);
};
// ── Tweaks ─────────────────────────────────────────────────────────
const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
"accent": "orange",
"radius": "soft",
"density": "comfy",
"cardStyle": "outline"
}/*EDITMODE-END*/;
const App = () => {
const [t, setTweak] = useTweaks(TWEAK_DEFAULTS);
// accent (warm tones only — brief mandates warm accent)
useEffect2(() => {
const map = {
orange: { a: "#ea580c", h: "#c2410c", soft: "#fff7ed" },
coral: { a: "#e11d48", h: "#be123c", soft: "#fff1f2" },
amber: { a: "#d97706", h: "#b45309", soft: "#fffbeb" },
};
const c = map[t.accent] || map.orange;
const r = document.documentElement;
r.style.setProperty("--accent", c.a);
r.style.setProperty("--accent-700", c.h);
r.style.setProperty("--accent-50", c.soft);
}, [t.accent]);
// radius
useEffect2(() => {
const map = {
sharp: { sm: "4px", md: "8px", lg: "10px", xl: "14px" },
soft: { sm: "8px", md: "14px", lg: "20px", xl: "28px" },
round: { sm: "12px", md: "20px", lg: "28px", xl: "36px" },
};
const r = map[t.radius] || map.soft;
const root = document.documentElement;
root.style.setProperty("--r-sm", r.sm);
root.style.setProperty("--r-md", r.md);
root.style.setProperty("--r-lg", r.lg);
root.style.setProperty("--r-xl", r.xl);
}, [t.radius]);
// density — adjusts section padding via class
useEffect2(() => {
document.documentElement.setAttribute("data-density", t.density);
const style = document.getElementById("__density-style") || document.createElement("style");
style.id = "__density-style";
const map = {
tight: { sec: "72px" },
comfy: { sec: "100px" },
airy: { sec: "140px" },
};
const m = map[t.density] || map.comfy;
style.textContent = `section { padding-top: ${m.sec} !important; padding-bottom: ${m.sec} !important; } section:first-of-type, section[data-density-skip] { padding-top: unset !important; padding-bottom: unset !important; }`;
if (!style.parentNode) document.head.appendChild(style);
}, [t.density]);
// card style
useEffect2(() => {
const style = document.getElementById("__cardstyle-style") || document.createElement("style");
style.id = "__cardstyle-style";
if (t.cardStyle === "filled") {
style.textContent = `.card { background: var(--surface-soft) !important; border-color: transparent !important; box-shadow: none !important; } .card:hover { background: var(--surface) !important; border-color: var(--border) !important; }`;
} else if (t.cardStyle === "shadow") {
style.textContent = `.card { background: var(--surface) !important; border-color: transparent !important; box-shadow: 0 6px 24px -8px rgba(15,23,42,0.12), 0 2px 4px rgba(15,23,42,0.04) !important; }`;
} else {
style.textContent = `.card { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-card); }`;
}
if (!style.parentNode) document.head.appendChild(style);
}, [t.cardStyle]);
return (
{/* Nav 는 header.php 가 PHP 단에서 렌더링 (다른 페이지와 통일) */}
setTweak("accent", v)}
options={[
{ value: "orange", label: "오렌지" },
{ value: "coral", label: "코랄" },
{ value: "amber", label: "앰버" },
]}
/>
setTweak("cardStyle", v)}
options={[
{ value: "outline", label: "라인" },
{ value: "filled", label: "면" },
{ value: "shadow", label: "그림자" },
]}
/>
setTweak("radius", v)}
options={[
{ value: "sharp", label: "각진" },
{ value: "soft", label: "기본" },
{ value: "round", label: "둥근" },
]}
/>
setTweak("density", v)}
options={[
{ value: "tight", label: "빽빽" },
{ value: "comfy", label: "기본" },
{ value: "airy", label: "여유" },
]}
/>
);
};
ReactDOM.createRoot(document.getElementById("root")).render();