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

feat(dropdown): support popupClassName #6404

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion src/components/dropdown/demos/demo1.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default () => {
return (
<>
<DemoBlock title='一列' padding={'0'}>
<Dropdown>
<Dropdown popupClassName='custom-dropdown-popup'>
<Dropdown.Item key='sorter' title='排序'>
<div style={{ padding: 12 }}>
<Radio.Group defaultValue='default'>
Expand Down
3 changes: 2 additions & 1 deletion src/components/dropdown/dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export type DropdownProps = {
onChange?: (key: string | null) => void
arrow?: React.ReactNode
getContainer?: PopupProps['getContainer']
popupClassName?: string
} & NativeProps

const defaultProps = {
Expand Down Expand Up @@ -127,7 +128,7 @@ const Dropdown = forwardRef<
visible={!!value}
position='top'
getContainer={props.getContainer}
className={`${classPrefix}-popup`}
className={classNames(`${classPrefix}-popup`, props.popupClassName)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

语义化结构吧,classNames.popup

maskClassName={`${classPrefix}-popup-mask`}
bodyClassName={`${classPrefix}-popup-body`}
style={{ top }}
Expand Down
1 change: 1 addition & 0 deletions src/components/dropdown/index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ It is suitable for filtering, sorting and changing the display range or order of
| defaultActiveKey | The default active `Item` key | `string \| null` | `null` |
| onChange | Triggered when `activeKey` changes | `(activeKey: string \| null)=> void` | - |
| getContainer | The parent container of the custom popup | `HTMLElement \| (() => HTMLElement) \| null` | `document.body` |
| popupClassName | `Dropdown` popup class name | `string` | - |

### Ref

Expand Down
1 change: 1 addition & 0 deletions src/components/dropdown/index.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
| defaultActiveKey | 默认激活的 `Item` `key` | `string \| null` | `null` |
| onChange | `activeKey` 变化时触发 | `(activeKey: string \| null)=> void` | - |
| getContainer | 自定义弹窗的父容器 | `HTMLElement \| (() => HTMLElement) \| null` | `document.body` |
| popupClassName | `Dropdown` 弹出层类名 | `string` | - |

### Ref

Expand Down