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