@kiwicom/orbit-components
Version:
Orbit-components is a React component library which provides developers with the easiest possible way of building Kiwi.com’s products.
34 lines (28 loc) • 698 B
JavaScript
import * as React from "react";
import { defaultTokens } from "@kiwicom/orbit-design-tokens";
import ThemeProvider from "../../ThemeProvider";
class RenderInRtl extends React.PureComponent {
constructor(...args) {
super(...args);
this.html = document.querySelector("html");
}
componentDidMount() {
if (this.html) {
this.html.setAttribute("dir", "rtl");
}
}
componentWillUnmount() {
if (this.html) {
this.html.removeAttribute("dir");
}
}
render() {
return /*#__PURE__*/React.createElement(ThemeProvider, {
theme: {
orbit: defaultTokens,
rtl: true
}
}, this.props.children);
}
}
export default RenderInRtl;