mirror of
https://github.com/binwiederhier/ntfy.git
synced 2024-09-27 19:12:00 +02:00
7a1488fcd3
Ref: https://mui.com/material-ui/guides/right-to-left https://m2.material.io/design/usability/bidirectionality.html
22 lines
614 B
JavaScript
22 lines
614 B
JavaScript
import React from "react";
|
|
|
|
import rtlPlugin from "stylis-plugin-rtl";
|
|
import { CacheProvider } from "@emotion/react";
|
|
import createCache from "@emotion/cache";
|
|
import { prefixer } from "stylis";
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
// https://mui.com/material-ui/guides/right-to-left
|
|
|
|
const cacheRtl = createCache({
|
|
key: "muirtl",
|
|
stylisPlugins: [prefixer, rtlPlugin],
|
|
});
|
|
|
|
const RTLCacheProvider = ({ children }) => {
|
|
const { i18n } = useTranslation();
|
|
|
|
return i18n.dir() === "rtl" ? <CacheProvider value={cacheRtl}>{children}</CacheProvider> : children;
|
|
};
|
|
|
|
export default RTLCacheProvider;
|