index.tsx 807 B

1234567891011121314151617181920212223
  1. import { Dropdown } from 'antd';
  2. import type { DropDownProps } from 'antd/es/dropdown';
  3. import React from 'react';
  4. import { useEmotionCss } from '@ant-design/use-emotion-css';
  5. import classNames from 'classnames';
  6. export type HeaderDropdownProps = {
  7. overlayClassName?: string;
  8. placement?: 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topCenter' | 'topRight' | 'bottomCenter';
  9. } & Omit<DropDownProps, 'overlay'>;
  10. const HeaderDropdown: React.FC<HeaderDropdownProps> = ({ overlayClassName: cls, ...restProps }) => {
  11. const className = useEmotionCss(({ token }) => {
  12. return {
  13. [`@media screen and (max-width: ${token.screenXS})`]: {
  14. width: '100%',
  15. },
  16. };
  17. });
  18. return <Dropdown overlayClassName={classNames(className, cls)} {...restProps} />;
  19. };
  20. export default HeaderDropdown;