Skip to content

Commit 0b94574

Browse files
committed
fix rtl support in mobile menu tab content
1 parent d007c11 commit 0b94574

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/components/Nav/MobileMenu/index.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { Languages, SearchIcon } from "lucide-react"
22
import { getLocale, getTranslations } from "next-intl/server"
33
import { Trigger as TabsTrigger } from "@radix-ui/react-tabs"
44

5+
import type { Lang } from "@/lib/types"
6+
57
import LanguagePicker from "@/components/LanguagePicker"
68
import ExpandIcon from "@/components/Nav/MobileMenu/ExpandIcon"
79
import LvlAccordion from "@/components/Nav/MobileMenu/LvlAccordion"
@@ -21,6 +23,7 @@ import { SheetCloseOnNavigate } from "@/components/ui/sheet-close-on-navigate"
2123
import { Tabs, TabsContent, TabsList } from "@/components/ui/tabs"
2224

2325
import { cn } from "@/lib/utils/cn"
26+
import { isLangRightToLeft } from "@/lib/utils/translations"
2427
import { slugify } from "@/lib/utils/url"
2528

2629
import { MOBILE_LANGUAGE_BUTTON_NAME, SECTION_LABELS } from "@/lib/constants"
@@ -42,6 +45,10 @@ export default async function MobileMenu({
4245
...props
4346
}: MobileMenuProps) {
4447
const t = await getTranslations({ namespace: "common" })
48+
const locale = await getLocale()
49+
const isRtl = isLangRightToLeft(locale as Lang)
50+
const side = isRtl ? "right" : "left"
51+
const dir = isRtl ? "rtl" : "ltr"
4552

4653
return (
4754
<SheetCloseOnNavigate>
@@ -53,7 +60,7 @@ export default async function MobileMenu({
5360
/>
5461
</SheetTrigger>
5562
<SheetContent
56-
side="left"
63+
side={side}
5764
hideOverlay
5865
className="flex flex-col"
5966
aria-describedby=""
@@ -63,6 +70,7 @@ export default async function MobileMenu({
6370
</SheetHeader>
6471

6572
<Tabs
73+
dir={dir}
6674
defaultValue="navigation"
6775
className="flex min-h-0 flex-1 flex-col"
6876
>

0 commit comments

Comments
 (0)