diff --git a/CHANGELOG.md b/CHANGELOG.md index 8481b4041b..378c078651 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Features - Add `on` and `mouseLeaveDelay` props to `Popup` component @mnajdova ([#622](https://github.com/stardust-ui/react/pull/622)) +### Fixes +- Fix unicode arrow characters to be RTL aware ([#690](https://github.com/stardust-ui/react/pull/690)) + ## [v0.16.0](https://github.com/stardust-ui/react/tree/v0.16.0) (2019-01-07) [Compare changes](https://github.com/stardust-ui/react/compare/v0.15.0...v0.16.0) diff --git a/src/themes/teams/components/Accordion/accordionTitleStyles.ts b/src/themes/teams/components/Accordion/accordionTitleStyles.ts index 1dd81499e0..ca642e8ee1 100644 --- a/src/themes/teams/components/Accordion/accordionTitleStyles.ts +++ b/src/themes/teams/components/Accordion/accordionTitleStyles.ts @@ -1,9 +1,11 @@ import { ICSSInJSStyle } from '../../../types' +import { getSideArrow } from '../../utils' const accordionTitleStyles = { root: ({ props, theme }): ICSSInJSStyle => { const { active } = props - const { arrowDown, arrowRight } = theme.siteVariables + const { arrowDown } = theme.siteVariables + const sideArrow = getSideArrow(theme) return { display: 'inline-block', verticalAlign: 'middle', @@ -11,7 +13,7 @@ const accordionTitleStyles = { cursor: 'pointer', '::before': { userSelect: 'none', - content: active ? `"${arrowDown}"` : `"${arrowRight}"`, + content: active ? `"${arrowDown}"` : `"${sideArrow}"`, }, } }, diff --git a/src/themes/teams/components/Menu/menuItemStyles.ts b/src/themes/teams/components/Menu/menuItemStyles.ts index 1f0c784e15..34c6aa9950 100644 --- a/src/themes/teams/components/Menu/menuItemStyles.ts +++ b/src/themes/teams/components/Menu/menuItemStyles.ts @@ -1,4 +1,4 @@ -import { pxToRem } from '../../utils' +import { pxToRem, getSideArrow } from '../../utils' import { ComponentSlotStyleFunction, ComponentSlotStylesInput, ICSSInJSStyle } from '../../../types' import { MenuVariables } from './menuVariables' import { MenuItemProps, MenuItemState } from '../../../../components/Menu/MenuItem' @@ -252,7 +252,8 @@ const menuItemStyles: ComponentSlotStylesInput { const { active, iconOnly, isFromKeyboard, pointing, primary, underlined, vertical } = props - const { arrowDown, arrowRight } = theme.siteVariables + const { arrowDown } = theme.siteVariables + const sideArrow = getSideArrow(theme) return { color: 'inherit', @@ -338,7 +339,7 @@ const menuItemStyles: ComponentSlotStylesInput basePxToRem(sizeInPx, themeFontSizeInPx) + +export const getSideArrow = (theme: ThemeInput) => { + const { rtl, siteVariables } = theme + const { arrowLeft, arrowRight } = siteVariables + return rtl ? arrowLeft : arrowRight +}