Initial commit
This commit is contained in:
30
src/components/RTLProvider/RTLProvider.js
Normal file
30
src/components/RTLProvider/RTLProvider.js
Normal file
@@ -0,0 +1,30 @@
|
||||
/*!
|
||||
|
||||
=========================================================
|
||||
* Argon Dashboard Chakra PRO - v1.0.0
|
||||
=========================================================
|
||||
|
||||
* Product Page: https://www.creative-tim.com/product/argon-dashboard-chakra-pro
|
||||
* Copyright 2022 Creative Tim (https://www.creative-tim.com/)
|
||||
|
||||
* Designed and Coded by Simmmple & Creative Tim
|
||||
|
||||
=========================================================
|
||||
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
*/
|
||||
|
||||
import { CacheProvider } from "@emotion/react";
|
||||
import createCache from "@emotion/cache";
|
||||
import rtl from "stylis-plugin-rtl";
|
||||
// NB: A unique `key` is important for it to work!
|
||||
const options = {
|
||||
rtl: { key: "css-ar", stylisPlugins: [rtl] },
|
||||
ltr: { key: "css-en" },
|
||||
};
|
||||
export function RtlProvider({ children }) {
|
||||
const dir = document.documentElement.dir == "ar" ? "rtl" : "ltr";
|
||||
const cache = createCache(options[dir]);
|
||||
return <CacheProvider value={cache} children={children} />;
|
||||
}
|
||||
Reference in New Issue
Block a user