Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: menu overflow #38989

Merged
merged 1 commit into from Nov 25, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions components/menu/style/horizontal.tsx
Expand Up @@ -10,7 +10,6 @@ const getHorizontalStyle: GenerateStyle<MenuToken> = (token) => {
lineWidth,
lineType,
menuItemPaddingInline,
menuItemMarginInline,
} = token;

return {
Expand All @@ -33,7 +32,6 @@ const getHorizontalStyle: GenerateStyle<MenuToken> = (token) => {
display: 'inline-block',
verticalAlign: 'bottom',
paddingInline: menuItemPaddingInline,
marginInline: menuItemMarginInline,
},

[`> ${componentCls}-item:hover,
Expand Down
16 changes: 12 additions & 4 deletions components/menu/style/index.tsx
Expand Up @@ -60,10 +60,10 @@ export interface MenuToken extends FullToken<'Menu'> {
menuItemHeight: number;
menuHorizontalHeight: number;
menuItemPaddingInline: number;
menuItemMarginInline: number;
menuArrowSize: number;
menuArrowOffset: string;
menuPanelMaskInset: number;
menuSubMenuBg: string;
}

// =============================== Base ===============================
Expand Down Expand Up @@ -409,8 +409,14 @@ export default (prefixCls: string, injectStyle: boolean): UseComponentStyleResul
return [];
}

const { colorPrimary, colorError, colorErrorHover, colorTextLightSolid, colorTextSecondary } =
token;
const {
colorBgElevated,
colorPrimary,
colorError,
colorErrorHover,
colorTextLightSolid,
colorTextSecondary,
} = token;

const { controlHeightLG, fontSize } = token;

Expand All @@ -420,11 +426,11 @@ export default (prefixCls: string, injectStyle: boolean): UseComponentStyleResul
const menuToken = mergeToken<MenuToken>(token, {
menuItemHeight: controlHeightLG,
menuItemPaddingInline: token.margin,
menuItemMarginInline: token.marginXXS,
menuArrowSize,
menuHorizontalHeight: controlHeightLG * 1.15,
menuArrowOffset: `${menuArrowSize * 0.25}px`,
menuPanelMaskInset: -7, // Still a hardcode here since it's offset by rc-align
menuSubMenuBg: colorBgElevated,
});

const menuDarkToken = mergeToken<MenuToken>(
Expand All @@ -451,6 +457,8 @@ export default (prefixCls: string, injectStyle: boolean): UseComponentStyleResul
colorDangerItemTextSelected: colorTextLightSolid,
colorDangerItemBgActive: colorError,
colorDangerItemBgSelected: colorError,

menuSubMenuBg: '#001529',
},
{
...overrideComponentToken,
Expand Down
3 changes: 2 additions & 1 deletion components/menu/style/theme.tsx
Expand Up @@ -40,6 +40,7 @@ const getThemeStyle = (token: MenuToken, themeSuffix: string): CSSInterpolation
colorDangerItemBgSelected,

colorItemBgHover,
menuSubMenuBg,
} = token;

return {
Expand Down Expand Up @@ -145,7 +146,7 @@ const getThemeStyle = (token: MenuToken, themeSuffix: string): CSSInterpolation
},

[`&${componentCls}-submenu > ${componentCls}`]: {
backgroundColor: colorItemBg,
backgroundColor: menuSubMenuBg,
},

[`&${componentCls}-popup > ${componentCls}`]: {
Expand Down
4 changes: 2 additions & 2 deletions components/menu/style/vertical.tsx
Expand Up @@ -7,11 +7,11 @@ const getVerticalInlineStyle: GenerateStyle<MenuToken, CSSObject> = (token) => {
const {
componentCls,
menuItemHeight,
menuItemMarginInline,
itemMarginInline,
padding,
menuArrowSize,
fontSize,
marginXXS,
} = token;

const paddingWithArrow = menuArrowSize + fontSize;
Expand All @@ -29,7 +29,7 @@ const getVerticalInlineStyle: GenerateStyle<MenuToken, CSSObject> = (token) => {
textOverflow: 'ellipsis',

marginInline: itemMarginInline,
marginBlock: menuItemMarginInline,
marginBlock: marginXXS,
width: `calc(100% - ${itemMarginInline * 2}px)`,
},

Expand Down