File size: 872 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { unit } from '@ant-design/cssinjs';
import type { CssUtil } from 'antd-style';

import type { MenuToken } from '.';
import type { GenerateStyle } from '../../theme/internal';

const getRTLStyle: GenerateStyle<MenuToken & CssUtil> = ({
  componentCls,
  menuArrowOffset,
  calc,
}) => ({
  [`${componentCls}-rtl`]: {
    direction: 'rtl',
  },

  [`${componentCls}-submenu-rtl`]: {
    transformOrigin: '100% 0',
  },

  // Vertical Arrow
  [`${componentCls}-rtl${componentCls}-vertical,
    ${componentCls}-submenu-rtl ${componentCls}-vertical`]: {
    [`${componentCls}-submenu-arrow`]: {
      '&::before': {
        transform: `rotate(-45deg) translateY(${unit(calc(menuArrowOffset).mul(-1).equal())})`,
      },

      '&::after': {
        transform: `rotate(45deg) translateY(${unit(menuArrowOffset)})`,
      },
    },
  },
});

export default getRTLStyle;