visuddhinanda 2 lat temu
rodzic
commit
d106acfbd6

+ 47 - 0
dashboard/src/components/article/ToolButtonNavMore.tsx

@@ -0,0 +1,47 @@
+import { SettingOutlined } from "@ant-design/icons";
+import { Button, Dropdown, MenuProps } from "antd";
+
+interface IWidget {
+  onSliceChange?: Function;
+}
+const CaseFormulaWidget = ({ onSliceChange }: IWidget) => {
+  const sliceOption = new Array(8).fill(1).map((item, index) => {
+    return { key: index + 2, label: index + 2 };
+  });
+  const items: MenuProps["items"] = [
+    {
+      label: "分组",
+      key: "slice",
+      children: [
+        {
+          label: "不分组",
+          key: 1,
+        },
+        ...sliceOption,
+      ],
+    },
+  ];
+  return (
+    <Dropdown
+      menu={{
+        items: items,
+        onClick: (e) => {
+          console.log("click ", e.key);
+          if (typeof onSliceChange !== "undefined") {
+            onSliceChange(e.key);
+          }
+        },
+      }}
+      placement="bottomRight"
+    >
+      <Button
+        type="text"
+        size="small"
+        icon={<SettingOutlined />}
+        onClick={(e) => e.preventDefault()}
+      />
+    </Dropdown>
+  );
+};
+
+export default CaseFormulaWidget;

+ 37 - 0
dashboard/src/components/article/ToolButtonNavSliceTitle.tsx

@@ -0,0 +1,37 @@
+import { Dropdown } from "antd";
+import React from "react";
+
+interface IWidget {
+  label?: React.ReactNode;
+  onMenuClick?: Function;
+}
+
+const ToolButtonNavSliceTitleWidget = ({ label, onMenuClick }: IWidget) => {
+  return (
+    <Dropdown.Button
+      type="text"
+      trigger={["click"]}
+      menu={{
+        items: [
+          {
+            key: "copy-link",
+            label: "复制链接",
+          },
+          {
+            key: "open",
+            label: "打开",
+          },
+        ],
+        onClick: (e) => {
+          if (typeof onMenuClick !== "undefined") {
+            onMenuClick(e.key);
+          }
+        },
+      }}
+    >
+      <>{label}</>
+    </Dropdown.Button>
+  );
+};
+
+export default ToolButtonNavSliceTitleWidget;