From a2e3aa70851150c4b20e543667354e44b39835d5 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Fri, 1 Aug 2025 20:51:40 -0400 Subject: [PATCH] Refactor background image rendering in Wrapper --- src/pages/index.jsx | 63 ++++++++++++++++++++---------------------- src/styles/globals.css | 14 ++++++++++ 2 files changed, 44 insertions(+), 33 deletions(-) diff --git a/src/pages/index.jsx b/src/pages/index.jsx index 4a9fde3a0..33b807c76 100644 --- a/src/pages/index.jsx +++ b/src/pages/index.jsx @@ -519,18 +519,6 @@ export default function Wrapper({ initialSettings, fallback }) { } } - const wrapperStyle = backgroundImage - ? { - backgroundImage: `linear-gradient(rgb(var(--bg-color) / ${opacity}), rgb(var(--bg-color) / ${opacity})), url('${backgroundImage}')`, - backgroundSize: "cover", - backgroundPosition: "center", - backgroundAttachment: "fixed", - backgroundRepeat: "no-repeat", - } - : { - backgroundColor: "rgb(var(--bg-color))", - }; - useEffect(() => { const html = document.documentElement; const body = document.body; @@ -540,31 +528,40 @@ export default function Wrapper({ initialSettings, fallback }) { html.classList.add(theme === "dark" ? "scheme-dark" : "scheme-light"); html.classList.remove(...Array.from(html.classList).filter((cls) => cls.startsWith("theme-"))); - const themeClass = initialSettings.color ? `theme-${initialSettings.color}` : "theme-slate"; - html.classList.add(themeClass); + html.classList.add(`theme-${initialSettings.color || "slate"}`); - return () => { - // Clean up background-related styles - body.style.backgroundImage = ""; - body.style.backgroundColor = ""; - }; + // Remove any previously applied inline styles + body.style.backgroundImage = ""; + body.style.backgroundColor = ""; + body.style.backgroundAttachment = ""; }, [backgroundImage, opacity, theme, initialSettings.color]); return ( -