Jiarenxiang | 38dcb05 | 2025-03-13 16:40:09 +0800 | [diff] [blame^] | 1 | import { Dropdown } from 'antd'; |
| 2 | import type { DropDownProps } from 'antd/es/dropdown'; |
| 3 | import React from 'react'; |
| 4 | import { createStyles } from 'antd-style'; |
| 5 | import classNames from 'classnames'; |
| 6 | |
| 7 | const useStyles = createStyles(({ token }) => { |
| 8 | return { |
| 9 | dropdown: { |
| 10 | [`@media screen and (max-width: ${token.screenXS}px)`]: { |
| 11 | width: '100%', |
| 12 | }, |
| 13 | }, |
| 14 | }; |
| 15 | }); |
| 16 | |
| 17 | export type HeaderDropdownProps = { |
| 18 | overlayClassName?: string; |
| 19 | placement?: 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topCenter' | 'topRight' | 'bottomCenter'; |
| 20 | } & Omit<DropDownProps, 'overlay'>; |
| 21 | |
| 22 | const HeaderDropdown: React.FC<HeaderDropdownProps> = ({ overlayClassName: cls, ...restProps }) => { |
| 23 | const { styles } = useStyles(); |
| 24 | return <Dropdown overlayClassName={classNames(styles.dropdown, cls)} {...restProps} />; |
| 25 | }; |
| 26 | |
| 27 | export default HeaderDropdown; |