From eceb0f3a54de21735b0c8827f03acc8f98d00050 Mon Sep 17 00:00:00 2001 From: MOH Date: Tue, 10 Mar 2026 17:42:02 +0100 Subject: [PATCH] Remove header block entrance motion --- components/layout/site-header.tsx | 88 +++++++++++++++++-------------- 1 file changed, 49 insertions(+), 39 deletions(-) diff --git a/components/layout/site-header.tsx b/components/layout/site-header.tsx index 1f5e1ba..6ac0943 100644 --- a/components/layout/site-header.tsx +++ b/components/layout/site-header.tsx @@ -5,7 +5,8 @@ import { LayoutDashboard, Menu, X } from "lucide-react"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { useLocale, useTranslations } from "next-intl"; -import { useEffect, useState } from "react"; +import { useEffect, useRef, useState } from "react"; +import { toast } from "sonner"; import { Container } from "@/components/layout/container"; import { LocaleToggle } from "@/components/layout/locale-toggle"; @@ -106,6 +107,7 @@ export function SiteHeader({ const [isOpen, setIsOpen] = useState(false); const [isScrolled, setIsScrolled] = useState(false); const [logoReplayKey, setLogoReplayKey] = useState(0); + const logoClickTimesRef = useRef([]); const pathname = usePathname(); const locale = useLocale(); const t = useTranslations("navigation"); @@ -114,26 +116,6 @@ export function SiteHeader({ const languageDirection = isArabic ? "rtl" : "ltr"; const titleMotion = getDirectionalReveal(languageDirection); const subtitleMotion = getDirectionalReveal(languageDirection); - const navEntranceInitial = reducedMotion ? false : { opacity: 0, y: -14, scale: 0.985, filter: "blur(8px)" }; - const navEntranceVisible = { opacity: 1, y: 0, scale: 1, filter: "blur(0px)" }; - const controlEntranceInitial = reducedMotion - ? false - : { - opacity: 0, - x: languageDirection === "rtl" ? -18 : 18, - scale: 0.98, - filter: "blur(8px)", - }; - const controlEntranceVisible = { opacity: 1, x: 0, scale: 1, filter: "blur(0px)" }; - const mobileMenuInitial = reducedMotion - ? false - : { - opacity: 0, - x: languageDirection === "rtl" ? -14 : 14, - scale: 0.94, - filter: "blur(8px)", - }; - const mobileMenuVisible = { opacity: 1, x: 0, scale: 1, filter: "blur(0px)" }; const brandSubtitle = isArabic ? "مــــــطـــــــــــــور ويــــــــــب | فــــــــــــريــــــلانــــــســــــر" : "Webdesigner Bremen | Freelancer"; @@ -157,6 +139,24 @@ export function SiteHeader({ }; }, []); + const handleLogoClick = (event: React.MouseEvent) => { + setLogoReplayKey((value) => value + 1); + + const now = Date.now(); + const recentClicks = logoClickTimesRef.current.filter((time) => now - time < 1200); + const nextClicks = [...recentClicks, now]; + + logoClickTimesRef.current = nextClicks; + + if (nextClicks.length < 3) { + return; + } + + logoClickTimesRef.current = []; + event.preventDefault(); + toast(t("logoTripleClick")); + }; + return (
@@ -173,7 +173,7 @@ export function SiteHeader({ setLogoReplayKey((value) => value + 1)} + onClick={handleLogoClick} >