Skip to content

Commit

Permalink
fix: Dropdown should not display when items is empty array
Browse files Browse the repository at this point in the history
  • Loading branch information
afc163 committed Feb 6, 2024
1 parent 54b7c3e commit f0528a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion components/dropdown/demo/basic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const items: MenuProps['items'] = [
];

const App: React.FC = () => (
<Dropdown menu={{ items }}>
<Dropdown menu={{ items: [] }}>
<a onClick={(e) => e.preventDefault()}>
<Space>
Hover me
Expand Down
4 changes: 4 additions & 0 deletions components/dropdown/style/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ const genBaseStyle: GenerateStyle<DropdownToken> = (token) => {
boxShadow: token.boxShadowSecondary,
...genFocusStyle(token),

'&:empty': {
padding: 0,
},

[`${menuCls}-item-group-title`]: {
padding: `${unit(paddingBlock!)} ${unit(controlPaddingHorizontal)}`,
color: token.colorTextDescription,
Expand Down

0 comments on commit f0528a8

Please sign in to comment.