Skip to content

Commit

Permalink
fix(menu): solve the problem of display being cropped by not enabling…
Browse files Browse the repository at this point in the history
… sliding in popup mode Tencent#2057
  • Loading branch information
PBK-B committed Apr 7, 2023
1 parent 64c936f commit 35ed317
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 34 deletions.
10 changes: 8 additions & 2 deletions src/menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const Menu = forwardRefWithStatics(
// 菜单宽度
const menuWidthArr = Array.isArray(width) ? width : [width, DEFAULT_MENU_WIDTH[1]];

const { collapsed } = value;
const { collapsed, expandType } = value;

return (
<MenuContext.Provider value={value}>
Expand All @@ -41,7 +41,13 @@ const Menu = forwardRefWithStatics(
>
<div className={`${classPrefix}-default-menu__inner`}>
{logo && <div className={`${classPrefix}-menu__logo`}>{logo}</div>}
<ul className={classNames(`${classPrefix}-menu`, { [`${classPrefix}-menu--scroll`]: !collapsed })}>
<ul
className={classNames(
`${classPrefix}-menu`,
{ [`${classPrefix}-menu--scroll`]: expandType !== 'popup' },
'narrow-scrollbar',
)}
>
{children}
</ul>
{operations && <div className={`${classPrefix}-menu__operations`}>{operations}</div>}
Expand Down
48 changes: 24 additions & 24 deletions test/snap/__snapshots__/csr.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -124167,7 +124167,7 @@ exports[`csr snapshot test > csr test src/layout/_example/aside.jsx 1`] = `
/>
</div>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item t-menu__item--plain"
Expand Down Expand Up @@ -124265,7 +124265,7 @@ exports[`csr snapshot test > csr test src/layout/_example/aside.jsx 1`] = `
/>
</div>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item t-menu__item--plain"
Expand Down Expand Up @@ -124916,7 +124916,7 @@ exports[`csr snapshot test > csr test src/layout/_example/combine.jsx 1`] = `
class="t-default-menu__inner"
>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item t-is-active"
Expand Down Expand Up @@ -125321,7 +125321,7 @@ exports[`csr snapshot test > csr test src/layout/_example/combine.jsx 1`] = `
class="t-default-menu__inner"
>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item t-is-active"
Expand Down Expand Up @@ -132315,7 +132315,7 @@ exports[`csr snapshot test > csr test src/menu/_example/closable-side.jsx 1`] =
</span>
</div>
<ul
class="t-menu"
class="t-menu narrow-scrollbar"
>
<li
class="t-menu__item"
Expand Down Expand Up @@ -132693,7 +132693,7 @@ exports[`csr snapshot test > csr test src/menu/_example/closable-side.jsx 1`] =
</span>
</div>
<ul
class="t-menu"
class="t-menu narrow-scrollbar"
>
<li
class="t-menu__item"
Expand Down Expand Up @@ -133793,7 +133793,7 @@ exports[`csr snapshot test > csr test src/menu/_example/custom-side.jsx 1`] = `
/>
</div>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item t-is-active t-menu__item--plain"
Expand Down Expand Up @@ -133892,7 +133892,7 @@ exports[`csr snapshot test > csr test src/menu/_example/custom-side.jsx 1`] = `
/>
</div>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item t-menu__item--plain"
Expand Down Expand Up @@ -133994,7 +133994,7 @@ exports[`csr snapshot test > csr test src/menu/_example/custom-side.jsx 1`] = `
/>
</div>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item t-is-active t-menu__item--plain"
Expand Down Expand Up @@ -134093,7 +134093,7 @@ exports[`csr snapshot test > csr test src/menu/_example/custom-side.jsx 1`] = `
/>
</div>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item t-menu__item--plain"
Expand Down Expand Up @@ -134893,7 +134893,7 @@ exports[`csr snapshot test > csr test src/menu/_example/group-side.jsx 1`] = `
/>
</div>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<div
class="t-menu-group"
Expand Down Expand Up @@ -135211,7 +135211,7 @@ exports[`csr snapshot test > csr test src/menu/_example/group-side.jsx 1`] = `
/>
</div>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<div
class="t-menu-group"
Expand Down Expand Up @@ -135585,7 +135585,7 @@ exports[`csr snapshot test > csr test src/menu/_example/multi-side.jsx 1`] = `
class="t-default-menu__inner"
>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item"
Expand Down Expand Up @@ -135987,7 +135987,7 @@ exports[`csr snapshot test > csr test src/menu/_example/multi-side.jsx 1`] = `
class="t-default-menu__inner"
>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item"
Expand Down Expand Up @@ -136346,7 +136346,7 @@ exports[`csr snapshot test > csr test src/menu/_example/multi-side.jsx 1`] = `
class="t-default-menu__inner"
>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item"
Expand Down Expand Up @@ -136748,7 +136748,7 @@ exports[`csr snapshot test > csr test src/menu/_example/multi-side.jsx 1`] = `
class="t-default-menu__inner"
>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item"
Expand Down Expand Up @@ -137955,7 +137955,7 @@ exports[`csr snapshot test > csr test src/menu/_example/popup-side.jsx 1`] = `
class="t-default-menu__inner"
>
<ul
class="t-menu"
class="t-menu narrow-scrollbar"
>
<li
class="t-menu__item"
Expand Down Expand Up @@ -138373,7 +138373,7 @@ exports[`csr snapshot test > csr test src/menu/_example/popup-side.jsx 1`] = `
class="t-default-menu__inner"
>
<ul
class="t-menu"
class="t-menu narrow-scrollbar"
>
<li
class="t-menu__item"
Expand Down Expand Up @@ -138739,7 +138739,7 @@ exports[`csr snapshot test > csr test src/menu/_example/popup-side.jsx 1`] = `
class="t-default-menu__inner"
>
<ul
class="t-menu"
class="t-menu narrow-scrollbar"
>
<li
class="t-menu__item"
Expand Down Expand Up @@ -139157,7 +139157,7 @@ exports[`csr snapshot test > csr test src/menu/_example/popup-side.jsx 1`] = `
class="t-default-menu__inner"
>
<ul
class="t-menu"
class="t-menu narrow-scrollbar"
>
<li
class="t-menu__item"
Expand Down Expand Up @@ -140250,7 +140250,7 @@ exports[`csr snapshot test > csr test src/menu/_example/single-side.jsx 1`] = `
/>
</div>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item t-is-active t-menu__item--plain"
Expand Down Expand Up @@ -140349,7 +140349,7 @@ exports[`csr snapshot test > csr test src/menu/_example/single-side.jsx 1`] = `
/>
</div>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item t-menu__item--plain"
Expand Down Expand Up @@ -140451,7 +140451,7 @@ exports[`csr snapshot test > csr test src/menu/_example/single-side.jsx 1`] = `
/>
</div>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item t-is-active t-menu__item--plain"
Expand Down Expand Up @@ -140550,7 +140550,7 @@ exports[`csr snapshot test > csr test src/menu/_example/single-side.jsx 1`] = `
/>
</div>
<ul
class="t-menu t-menu--scroll"
class="t-menu t-menu--scroll narrow-scrollbar"
>
<li
class="t-menu__item t-menu__item--plain"
Expand Down
Loading

0 comments on commit 35ed317

Please sign in to comment.