ant-design/components/menu/style/rtl.tsx
kiner-tang(文辉) 3128539211
feat: menu support css variable theme (#45750)
* feat: layout support cssVar

* feat: menu support cssVar

* feat: menu support cssVar

* feat: menu support cssVar

* feat: menu support cssVar

* feat: optimize code

* feat: optimize code

* feat: optimize code

* feat: optimize code

* feat: optimize code

* feat: optimize code
2023-11-13 09:38:05 +08:00

35 lines
871 B
TypeScript

import type { CssUtil } from 'antd-style';
import type { MenuToken } from '.';
import type { GenerateStyle } from '../../theme/internal';
import { unit } from '@ant-design/cssinjs';
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;