Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion components/menu/src/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import type { ItemType } from './hooks/useItems';
import useItems from './hooks/useItems';
import useStyle from '../style';
import { useInjectOverride } from './OverrideContext';
import useCSSVarCls from '../../config-provider/hooks/useCssVarCls';

export const menuProps = () => ({
id: String,
Expand Down Expand Up @@ -106,8 +107,10 @@ export default defineComponent({
const prefixCls = computed(() => {
return getPrefixCls('menu', props.prefixCls || override?.prefixCls?.value);
});
const [wrapSSR, hashId] = useStyle(
const rootCls = useCSSVarCls(prefixCls);
const [wrapSSR, hashId, cssVarCls] = useStyle(
prefixCls,
rootCls,
computed(() => {
return !override;
}),
Expand Down Expand Up @@ -336,6 +339,8 @@ export default defineComponent({
[`${prefixCls.value}-inline-collapsed`]: mergedInlineCollapsed.value,
[`${prefixCls.value}-rtl`]: isRtl.value,
[`${prefixCls.value}-${props.theme}`]: true,
[rootCls.value]: true,
[cssVarCls.value]: true,
};
});
const rootPrefixCls = computed(() => getPrefixCls());
Expand Down Expand Up @@ -411,6 +416,7 @@ export default defineComponent({
);
useProvideMenu({
prefixCls,
cssVarCls: computed(() => `${rootCls.value} ${cssVarCls.value}`),
activeKeys,
openKeys: mergedOpenKeys,
selectedKeys: mergedSelectedKeys,
Expand Down
2 changes: 2 additions & 0 deletions components/menu/src/SubMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export default defineComponent({

const {
prefixCls,
cssVarCls,
activeKeys,
disabled: contextDisabled,
changeActiveKeys,
Expand Down Expand Up @@ -210,6 +211,7 @@ export default defineComponent({

const popupClassName = computed(() =>
classNames(
cssVarCls.value,
prefixCls.value,
`${prefixCls.value}-${props.theme || theme.value}`,
props.popupClassName,
Expand Down
1 change: 1 addition & 0 deletions components/menu/src/hooks/useMenuContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface MenuContextProps {
registerMenuInfo: (key: string, info: StoreMenuInfo) => void;
unRegisterMenuInfo: (key: string) => void;
prefixCls: ComputedRef<string>;
cssVarCls: ComputedRef<string>;
openKeys: Ref<Key[]>;
selectedKeys: Ref<Key[]>;

Expand Down
11 changes: 6 additions & 5 deletions components/menu/style/horizontal.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import { unit } from '../../_util/cssinjs';
import type { MenuToken } from '.';
import type { GenerateStyle } from '../../theme/internal';

const getHorizontalStyle: GenerateStyle<MenuToken> = token => {
const {
componentCls,
motionDurationSlow,
menuHorizontalHeight,
horizontalLineHeight,
colorSplit,
lineWidth,
lineType,
menuItemPaddingInline,
itemPaddingInline,
} = token;

return {
[`${componentCls}-horizontal`]: {
lineHeight: `${menuHorizontalHeight}px`,
lineHeight: horizontalLineHeight,
border: 0,
borderBottom: `${lineWidth}px ${lineType} ${colorSplit}`,
borderBottom: `${unit(lineWidth)} ${lineType} ${colorSplit}`,
boxShadow: 'none',

'&::after': {
Expand All @@ -31,7 +32,7 @@ const getHorizontalStyle: GenerateStyle<MenuToken> = token => {
position: 'relative',
display: 'inline-block',
verticalAlign: 'bottom',
paddingInline: menuItemPaddingInline,
paddingInline: itemPaddingInline,
},

[`> ${componentCls}-item:hover,
Expand Down
Loading