UNPKG

@workday/canvas-kit-react

Version:

The parent module that contains all Workday Canvas Kit React components

21 lines (20 loc) 598 B
import * as React from 'react'; import { ThemeContext } from '@emotion/react'; import { ContentDirection } from './types'; function useDefaultTheme(theme, config, fn) { return theme || fn(config); } /** * This is a small hook to support right-to-left logic. * It returns a boolean * * ```ts * const isRTL = useIsRTL(); * ``` * * @deprecated Use isElementRTL instead. */ export const useIsRTL = (partialTheme) => { const theme = useDefaultTheme(partialTheme, ThemeContext, React.useContext); return (theme && theme.canvas && theme.canvas.direction) === ContentDirection.RTL; };