| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- import { useIntl } from "react-intl";
- import { Badge, Dropdown } from "antd";
- import type { MenuProps } from "antd";
- import { BlockOutlined, CalendarOutlined } from "@ant-design/icons";
- const handleButtonClick = (e: React.MouseEvent<HTMLButtonElement>) => {
- console.log("click left button", e);
- };
- interface IWidget {
- style?: React.CSSProperties;
- sentId: string;
- count?: number;
- onMenuClick?: Function;
- }
- const SentTabButtonWidget = ({
- style,
- ___sentId,
- onMenuClick,
- count = 0,
- }: IWidget) => {
- const intl = useIntl();
- const items: MenuProps["items"] = [
- {
- label: "排序",
- key: "orderby",
- icon: <CalendarOutlined />,
- children: [
- {
- label: "完成度",
- key: "progress",
- },
- {
- label: "问题数量",
- key: "qa",
- },
- ],
- },
- {
- label: "显示完成度",
- key: "show-progress",
- icon: <BlockOutlined />,
- },
- ];
- const handleMenuClick: MenuProps["onClick"] = (e) => {
- e.domEvent.stopPropagation();
- if (typeof onMenuClick !== "undefined") {
- onMenuClick(e.keyPath);
- }
- };
- const menuProps = {
- items,
- onClick: handleMenuClick,
- };
- return (
- <Dropdown.Button
- style={style}
- size="small"
- type="text"
- menu={menuProps}
- onClick={handleButtonClick}
- >
- {intl.formatMessage({
- id: "buttons.wbw",
- })}
- <Badge size="small" color="geekblue" count={count}></Badge>
- </Dropdown.Button>
- );
- };
- export default SentTabButtonWidget;
|