react-modern-gantt
Version:
A modern, customizable Gantt chart component for React applications with export functionality
85 lines (84 loc) • 1.84 kB
TypeScript
import React from "react";
import { ExportFormat } from "@/types";
/**
* Props for ExportPreview component
*/
export interface ExportPreviewProps {
/**
* Whether the modal is open
*/
isOpen: boolean;
/**
* Callback when modal should close
*/
onClose: () => void;
/**
* Data URL or Blob URL to preview
*/
previewUrl: string | null;
/**
* Format of the preview
*/
format: ExportFormat;
/**
* Filename for download
*/
filename?: string;
/**
* Custom title
*/
title?: string;
/**
* Dark mode
*/
darkMode?: boolean;
/**
* Show download button
* @default true
*/
showDownload?: boolean;
/**
* Custom className
*/
className?: string;
/**
* Custom styles
*/
style?: React.CSSProperties;
}
/**
* ExportPreview Component
* A modal for previewing exported Gantt charts before download
*
* @example
* ```tsx
* import { ExportPreview, useGanttExport } from 'react-modern-gantt';
*
* function MyComponent() {
* const { ganttRef, getDataUrl } = useGanttExport();
* const [previewUrl, setPreviewUrl] = useState(null);
* const [isOpen, setIsOpen] = useState(false);
*
* const handlePreview = async () => {
* const url = await getDataUrl('png');
* setPreviewUrl(url);
* setIsOpen(true);
* };
*
* return (
* <>
* <GanttChart ref={ganttRef} tasks={tasks} />
* <button onClick={handlePreview}>Preview Export</button>
* <ExportPreview
* isOpen={isOpen}
* onClose={() => setIsOpen(false)}
* previewUrl={previewUrl}
* format="png"
* />
* </>
* );
* }
* ```
*/
export declare const ExportPreview: React.FC<ExportPreviewProps>;
export default ExportPreview;