UNPKG

@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.

37 lines (29 loc) 916 B
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 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); _defineProperty(this, "html", document.querySelector("html")); } componentDidMount() { if (this.html) { this.html.setAttribute("dir", "rtl"); } } componentWillUnmount() { if (this.html) { this.html.removeAttribute("dir"); } } render() { return React.createElement(ThemeProvider, { theme: { orbit: defaultTokens, rtl: true } }, this.props.children); } } export default RenderInRtl;