"use client";
import type { ReactNode } from "react";
import { Box, Typography } from "@mui/material";
import { SearchOffOutlined } from "@mui/icons-material";
import { alpha } from "@mui/material/styles";
export interface PanelEmptyStateProps {
icon?: ReactNode;
title: string;
description?: string;
variant?: "panel" | "compact";
}
const PanelEmptyState = ({
icon,
title,
description,
variant = "panel",
}: PanelEmptyStateProps) => {
const compact = variant === "compact";
return (
({
width: "100%",
height: compact ? "auto" : "100%",
minHeight: compact ? 48 : 220,
display: "flex",
flexDirection: compact ? "row" : { xs: "column", sm: "row" },
alignItems: "center",
justifyContent: "center",
gap: compact ? 1.5 : { xs: 1.75, sm: 2.5 },
px: compact ? 1.5 : { xs: 2, sm: 4 },
py: compact ? 1.25 : { xs: 4, sm: 5 },
color: "text.secondary",
textAlign: compact ? "left" : { xs: "center", sm: "left" },
boxSizing: "border-box",
"& .MuiTypography-root": {
textWrap: "pretty",
},
"& .MuiSvgIcon-root": {
fontSize: compact ? 22 : 32,
},
"& > [aria-hidden='true']": {
flex: "0 0 auto",
width: compact ? 36 : 56,
height: compact ? 36 : 56,
borderRadius: compact ? 2 : 3,
display: "grid",
placeItems: "center",
color: "primary.main",
backgroundColor: alpha(theme.palette.primary.main, 0.08),
boxShadow: `inset 0 0 0 1px ${alpha(
theme.palette.primary.main,
0.12,
)}`,
},
})}
>
{icon ? {icon} : null}
{title}
{description ? (
{description}
) : null}
);
};
export interface SchemeQueryEmptyStateProps {
hasQueried: boolean;
}
export const SchemeQueryEmptyState = ({
hasQueried,
}: SchemeQueryEmptyStateProps) => (
}
title={hasQueried ? "未找到符合条件的方案" : "尚未查询历史方案"}
description={
hasQueried
? "请调整查询条件后重新查询,或先创建一个新方案。"
: "设置查询条件后点击“查询”,这里将显示可查看的历史方案。"
}
/>
);
export default PanelEmptyState;