ant-design/components/menu/style/horizontal.tsx
MadCcc d7c2f5f5d3
feat: menu theme implemented by design token (#36738)
* feat: menu theme implemented by design token

* test: fix test

* fix: lint

* fix: menu motion

* 偷偷加了几个token

Co-authored-by: 期贤 <qixian.cs@antgroup.com>
2022-07-28 20:33:10 +08:00

58 lines
1.5 KiB
TypeScript

import type { MenuToken } from '.';
import type { GenerateStyle } from '../../theme';
const getHorizontalStyle: GenerateStyle<MenuToken> = token => {
const {
componentCls,
motionDurationSlow,
menuHorizontalHeight,
colorBorderSecondary,
lineWidth,
lineType,
menuItemPaddingInline,
} = token;
return {
[`${componentCls}-horizontal`]: {
lineHeight: `${menuHorizontalHeight}px`,
border: 0,
borderBottom: `${lineWidth}px ${lineType} ${colorBorderSecondary}`,
boxShadow: 'none',
'&::after': {
display: 'block',
clear: 'both',
height: 0,
content: '"\\20"',
},
// ======================= Item =======================
[`${componentCls}-item, ${componentCls}-submenu`]: {
position: 'relative',
display: 'inline-block',
verticalAlign: 'bottom',
paddingInline: menuItemPaddingInline,
},
[`> ${componentCls}-item:hover,
> ${componentCls}-item-active,
> ${componentCls}-submenu ${componentCls}-submenu-title:hover`]: {
backgroundColor: 'transparent',
},
[`${componentCls}-item, ${componentCls}-submenu-title`]: {
transition: [`border-color ${motionDurationSlow}`, `background ${motionDurationSlow}`].join(
',',
),
},
// ===================== Sub Menu =====================
[`${componentCls}-submenu-arrow`]: {
display: 'none',
},
},
};
};
export default getHorizontalStyle;