From 17c49a339edff807111629bce0c9ec1c0c9950e4 Mon Sep 17 00:00:00 2001 From: Dariusz Niemczyk Date: Sun, 13 Apr 2025 21:37:18 +0200 Subject: [PATCH] fix: properly fix colors-sections --- package-lock.json | 17 +++++++++ package.json | 1 + src/components/mobile-nav.tsx | 20 +++++----- src/components/nav.tsx | 32 ++++++++-------- src/globals.css | 8 ++++ src/hooks/color-sections.tsx | 72 ----------------------------------- 6 files changed, 52 insertions(+), 98 deletions(-) delete mode 100644 src/hooks/color-sections.tsx diff --git a/package-lock.json b/package-lock.json index 2b11f21..ebdff5c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36,6 +36,7 @@ "react-dom": "^19.0.0", "react-hook-form": "^7.54.2", "react-leaflet": "^5.0.0-rc.2", + "react-scrollspy-navigation": "^2.0.6", "tailwind-merge": "^2.6.0", "tailwindcss-animate": "^1.0.7", "zod": "^3.24.1" @@ -9808,6 +9809,22 @@ } } }, + "node_modules/react-scrollspy-navigation": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/react-scrollspy-navigation/-/react-scrollspy-navigation-2.0.6.tgz", + "integrity": "sha512-BBnIEI9BsCPIMnp3z/OIEJ6mRSlDgGYf8wty5IjR8nOIhIeRhQp6eDUAKFMyHRoM2RUInA2NDu5DutIFTphoKQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/toviszsolt" + }, + { + "type": "paypal", + "url": "https://www.paypal.com/paypalme/toviszsolt" + } + ], + "license": "MIT" + }, "node_modules/react-style-singleton": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/react-style-singleton/-/react-style-singleton-2.2.3.tgz", diff --git a/package.json b/package.json index c239b8d..6bee744 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "react-dom": "^19.0.0", "react-hook-form": "^7.54.2", "react-leaflet": "^5.0.0-rc.2", + "react-scrollspy-navigation": "^2.0.6", "tailwind-merge": "^2.6.0", "tailwindcss-animate": "^1.0.7", "zod": "^3.24.1" diff --git a/src/components/mobile-nav.tsx b/src/components/mobile-nav.tsx index 7486423..28d36ee 100644 --- a/src/components/mobile-nav.tsx +++ b/src/components/mobile-nav.tsx @@ -2,10 +2,9 @@ import { Button } from "@/components/ui/button" import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetTrigger } from "@/components/ui/sheet" -import { useColorSections } from "@/hooks/color-sections" import type { Sections, translations } from "@/i18n/translations" import { Menu } from "lucide-react" -import { useRef } from "react" +import ScrollSpy from "react-scrollspy-navigation" import { LanguageSelector } from "./ui/language-selector" function NavContent({ @@ -15,15 +14,16 @@ function NavContent({ t: typeof translations.pl, linksOrder: Array }) { - const parent = useRef(null); - useColorSections(parent); return ( -