Skip to content

Commit 8b0b32d

Browse files
committed
feat: add rtl-detection
1 parent 58669fe commit 8b0b32d

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

apps/docs/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"next-intl": "^4.1.0",
2727
"react": "^19.1.0",
2828
"react-dom": "^19.1.0",
29+
"rtl-detect": "^1.1.2",
2930
"tailwind-merge": "^3.3.0",
3031
"zod": "3.24.4"
3132
},
@@ -39,6 +40,7 @@
3940
"@types/node": "22.15.3",
4041
"@types/react": "^19.1.6",
4142
"@types/react-dom": "^19.1.5",
43+
"@types/rtl-detect": "^1.0.3",
4244
"eslint": "^8.57.1",
4345
"eslint-config-next": "15.3.1",
4446
"github-slugger": "^2.0.0",

apps/docs/src/app/layout.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { getLocale, getTranslations } from 'next-intl/server';
77
import { baseUrl, createMetadata } from '@/lib/metadata';
88
import type { Viewport } from 'next';
99
import { Geist, Geist_Mono } from 'next/font/google';
10+
import { getLangDir } from 'rtl-detect';
1011

1112
export async function generateMetadata() {
1213
const t = await getTranslations('meta');
@@ -44,16 +45,18 @@ export default async function Layout({
4445
children: React.ReactNode;
4546
}) {
4647
const locale = await getLocale();
48+
const direction = getLangDir(locale);
4749

4850
return (
4951
<html
5052
lang={locale}
53+
dir={direction}
5154
className={`${geist.variable} ${mono.variable}`}
5255
suppressHydrationWarning
5356
>
54-
<body className="flex flex-col min-h-screen">
57+
<body className="flex flex-col min-h-screen" dir={direction}>
5558
<NextIntlClientProvider>
56-
<Provider>{children}</Provider>
59+
<Provider dir={direction}>{children}</Provider>
5760
</NextIntlClientProvider>
5861
</body>
5962
</html>

apps/docs/src/app/provider.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@
22

33
import { ORAMA_CONFIGS_MAP } from '@/lib/orama/config';
44
import { RootProvider } from 'fumadocs-ui/provider';
5+
import type { RootProviderProps } from 'fumadocs-ui/provider/base';
56
import { useLocale } from 'next-intl';
67
import dynamic from 'next/dynamic';
7-
import type { ReactNode } from 'react';
88

99
const SearchDialog = dynamic(() => import('@/components/search-dialog'), {
1010
ssr: false,
1111
});
1212

13-
export function Provider({ children }: { children: ReactNode }) {
13+
export function Provider({ children, ...props }: RootProviderProps) {
1414
const locale = useLocale();
1515
const config = ORAMA_CONFIGS_MAP[locale];
1616
return (
1717
<RootProvider
18+
{...props}
1819
search={
1920
config
2021
? {

pnpm-lock.yaml

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)