import { useNavigate } from "react-router";
import { Button, Card, Dropdown, Space } from "antd";
import { MoreOutlined, ReloadOutlined } from "@ant-design/icons";
import type { MenuProps } from "antd";
import type { IWidgetArticleData } from "./ArticleView"
import ArticleCardMainMenu from "./ArticleCardMainMenu";
import ModeSwitch from "./ModeSwitch";
interface IWidgetArticleCard {
type?: string;
articleId?: string;
data?: IWidgetArticleData;
children?: React.ReactNode;
onModeChange?: Function;
openInCol?: Function;
showCol?: Function;
}
const ArticleCardWidget = ({
type,
articleId,
data,
children,
onModeChange,
showCol,
}: IWidgetArticleCard) => {
const navigate = useNavigate();
const onClick: MenuProps["onClick"] = (e) => {
console.log("click ", e);
switch (e.key) {
case "showCol":
if (typeof showCol !== "undefined") {
showCol();
}
break;
default:
break;
}
};
const items: MenuProps["items"] = [
{
key: "showCol",
label: "显示分栏",
},
];
const contextMenu = (
}>
);
return (
{}
{data?.title}
}
extra={
{
if (typeof onModeChange !== "undefined") {
onModeChange(mode);
}
navigate(`/article/${type}/${articleId}/${mode}`);
}}
/>
}
>
{contextMenu}
}
bodyStyle={{ height: `calc(100vh - 94px)`, overflowY: "scroll" }}
>
{children}
);
};
export default ArticleCardWidget;