From 5400fd360aeda6116a78e03a1821a02ff7621183 Mon Sep 17 00:00:00 2001 From: Parsa Aghayi Date: Mon, 2 Nov 2026 13:57:23 +0000 Subject: [PATCH] fix(mobile): strictly align drawer slide direction with button side and make header RTL aware --- .../(routes)/(website)/components/header/header.tsx | 5 ++++- .../(website)/components/mobile-menu/mobileMenu.tsx | 10 ++++------ src/app/(routes)/blog/components/header/header.tsx | 12 +++++++++--- .../blog/components/mobile-menu/mobileMenu.tsx | 10 ++++------ 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/app/(routes)/(website)/components/header/header.tsx b/src/app/(routes)/(website)/components/header/header.tsx index 5989c07..b367b92 100644 --- a/src/app/(routes)/(website)/components/header/header.tsx +++ b/src/app/(routes)/(website)/components/header/header.tsx @@ -8,12 +8,14 @@ import { ThemeToggle } from "../theme-toggle/theme-toggle"; import { getCookie } from "cookies-next"; import { getDictionary } from "@/app/lib/functions/dictionaries"; import { Dictionary } from "@/app/types/types"; +import { useSelectedLocale } from "@/app/lib/hooks/use-selected-locale"; export default function Header() { const [dict, setDict] = useState(null); const [scrolled, setScrolled] = useState(false); - const selectedLocale = getCookie("selectedLocale") || getCookie("defaultLocale") || "en"; + const selectedLocale = useSelectedLocale(); + const isRTL = selectedLocale === "fa"; useEffect(() => { const loadDict = async () => { @@ -44,6 +46,7 @@ export default function Header() { return (
{/* Header */} diff --git a/src/app/(routes)/blog/components/header/header.tsx b/src/app/(routes)/blog/components/header/header.tsx index f45ccd7..5ffae10 100644 --- a/src/app/(routes)/blog/components/header/header.tsx +++ b/src/app/(routes)/blog/components/header/header.tsx @@ -11,7 +11,10 @@ import { getDictionary } from "@/app/lib/functions/dictionaries"; import { getDefaultLocale } from "@/app/lib/functions/utils"; export default async function Header() { - const dict = await getDictionary(await getDefaultLocale()); + const cookieStore = await cookies(); + const currentLocale = cookieStore.get("selectedLocale")?.value || (await getDefaultLocale()); + const isRTL = currentLocale === "fa"; + const dict = await getDictionary(currentLocale as "en" | "fa"); const subscribeLabels = { buttonTitle: dict.blog.header.button, trigger: dict.blog.header.button, @@ -19,7 +22,10 @@ export default async function Header() { }; return ( -
+
@@ -53,6 +59,6 @@ export default async function Header() {
-
+
); } diff --git a/src/app/(routes)/blog/components/mobile-menu/mobileMenu.tsx b/src/app/(routes)/blog/components/mobile-menu/mobileMenu.tsx index e69ac30..cea12cf 100644 --- a/src/app/(routes)/blog/components/mobile-menu/mobileMenu.tsx +++ b/src/app/(routes)/blog/components/mobile-menu/mobileMenu.tsx @@ -108,12 +108,10 @@ export default function MobileMenu({ clicked, setClicked }: PropsType) { {/* Full Height Solid Drawer */}
{/* Header */}