"use client"; import { Card, CardContent, Typography, Stack, Button } from "@mui/material"; import FileDownload from "@mui/icons-material/FileDownload"; import { exportChartToXlsx } from "./exportChartToXlsx"; export default function ChartCard({ title, filters, children, exportFilename, exportData, }: { title: string; filters?: React.ReactNode; children: React.ReactNode; /** If provided with exportData, shows "匯出 Excel" button. */ exportFilename?: string; exportData?: Record[]; }) { const handleExport = () => { if (exportFilename && exportData) { exportChartToXlsx(exportData, exportFilename); } }; return ( {title} {filters} {exportFilename && exportData && ( )} {children} ); }