add rtlLocales array

This commit is contained in:
Ashraf Monshi 2021-05-16 09:27:48 +03:00
parent 703a1e13db
commit afc4940680
4 changed files with 8 additions and 3 deletions

View file

@ -3,6 +3,7 @@ import Head from 'next/head';
import Header from 'components/layout/Header';
import Footer from 'components/layout/Footer';
import useLocale from 'hooks/useLocale';
import { rtlLocales } from 'lib/lang';
export default function Layout({ title, children, header = true, footer = true }) {
const [locale] = useLocale();
@ -14,7 +15,7 @@ export default function Layout({ title, children, header = true, footer = true }
</Head>
{header && <Header />}
<main className="container" dir={locale === 'ar-SA' ? 'rtl' : 'ltr'}>
<main className="container" dir={rtlLocales.includes(locale) ? 'rtl' : 'ltr'}>
{children}
</main>
{footer && <Footer />}