fix background issue

This commit is contained in:
incognitotgt 2024-04-15 19:48:16 -04:00
parent 7117e67e0a
commit 6b5e863461
No known key found for this signature in database
GPG key ID: D229D19A500C60B0
3 changed files with 17 additions and 16 deletions

View file

@ -54,7 +54,11 @@ export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
root.classList.remove(theme); root.classList.remove(theme);
}); });
root.classList.add(theme); root.classList.add(theme);
}, [theme, themes]); document.documentElement.style.setProperty(
"--background-image",
`url(${background})`
);
}, [theme, themes, background]);
const value = { const value = {
theme, theme,

View file

@ -6,7 +6,7 @@ import Particles, { initParticlesEngine } from "@tsparticles/react";
import { loadSlim } from "@tsparticles/slim"; import { loadSlim } from "@tsparticles/slim";
import { useEffect, useState } from "preact/compat"; import { useEffect, useState } from "preact/compat";
import { ThemeProvider, useTheme } from "./components/ThemeProvider"; import { ThemeProvider } from "./components/ThemeProvider";
const Routes = lazy(() => import("./routes")); const Routes = lazy(() => import("./routes"));
@ -29,27 +29,16 @@ export default function App() {
setInit(true); setInit(true);
}); });
}, []); }, []);
const { background } = useTheme();
const particlesLoaded = (container) => { const particlesLoaded = (container) => {
console.log(container); console.log(container);
}; };
return ( return (
<div class="h-screen w-screen"> <div>
{window.location.origin === "https://nebulaproxy.io" && <Meta />} {window.location.origin === "https://nebulaproxy.io" && <Meta />}
{/* {window.location.origin === "http://localhost:8080" && <Meta />} */} {/* {window.location.origin === "http://localhost:8080" && <Meta />} */}
<Suspense fallback={<LoadSuspense />}> <Suspense fallback={<LoadSuspense />}>
<div className="absolute z-20 h-full w-full">
<Routes /> <Routes />
</div> <div className="z-10 h-full w-full bg-primary">
<div
className="z-10 h-full w-full bg-primary"
style={{
backgroundImage: `url(${background})`,
backgroundSize: "contain",
backgroundRepeat: "repeat",
backgroundPosition: "center"
}}
>
{init && particlesUrl !== "none" && ( {init && particlesUrl !== "none" && (
<Particles <Particles
id="tsparticles" id="tsparticles"

View file

@ -6,6 +6,7 @@
@layer base { @layer base {
:root, :root,
.main { .main {
--background-image: url();
--background-primary: #191724; --background-primary: #191724;
--background-lighter: #16121f; --background-lighter: #16121f;
--navbar-color: #26233a; --navbar-color: #26233a;
@ -120,6 +121,13 @@
--active-color: #8839ef !important; --active-color: #8839ef !important;
} }
} }
body {
@apply bg-primary;
background-image: var(--background-image);
background-position: center;
background-size: cover;
background-attachment: fixed;
}
.font-inter { .font-inter {
font-family: "Inter", sans-serif; font-family: "Inter", sans-serif;