From 1fbc023ec595c88ef11fdd9affd6a0a287cf3aaf Mon Sep 17 00:00:00 2001 From: Cooper Ransom Date: Wed, 3 Apr 2024 19:52:18 -0400 Subject: [PATCH] Adjust scroll bar to match current theme ! --- src/pages/Discover.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pages/Discover.tsx b/src/pages/Discover.tsx index 894ac08d..3d560ba7 100644 --- a/src/pages/Discover.tsx +++ b/src/pages/Discover.tsx @@ -8,8 +8,10 @@ import { ThinContainer } from "@/components/layout/ThinContainer"; import { WideContainer } from "@/components/layout/WideContainer"; import { HomeLayout } from "@/pages/layouts/HomeLayout"; import { conf } from "@/setup/config"; +import { useThemeStore } from "@/stores/theme"; import { PageTitle } from "./parts/util/PageTitle"; +import { allThemes } from "../../themes/all"; import { get } from "../backend/metadata/tmdb"; import { Icon, Icons } from "../components/Icon"; @@ -65,6 +67,10 @@ export function Discover() { [genreId: number]: Movie[]; }>({}); const [countdown, setCountdown] = useState(null); + const themeName = useThemeStore((s) => s.theme); + const currentTheme = allThemes.find((y) => y.name === themeName); + const bgColor = + currentTheme?.extend?.colors?.background?.accentA ?? "#7831BF"; const navigate = useNavigate(); // Add a new state variable for the category movies @@ -238,7 +244,7 @@ export function Discover() { useEffect(() => { return () => { - document.documentElement.style.scrollbarWidth = "none"; // Hide page scroll bar + document.documentElement.style.scrollbarWidth = "none"; }; }, []); @@ -267,7 +273,7 @@ export function Discover() { className="flex whitespace-nowrap overflow-auto scrollbar pb-6 mb-4 mt-4" style={{ scrollbarWidth: "thin", - scrollbarColor: "#fff transparent", + scrollbarColor: `${bgColor} transparent`, }} ref={(el) => { carouselRefs.current[categorySlug] = el;