2024-06-04 08:33:55 -05:00
|
|
|
import { LoadingIndicator } from '@create-figma-plugin/ui';
|
2024-05-03 06:43:07 -05:00
|
|
|
|
2024-10-18 06:34:10 -05:00
|
|
|
import { LibraryError } from '@ui/components/LibraryError';
|
2024-06-04 11:02:59 -05:00
|
|
|
import { useFigmaContext } from '@ui/context';
|
2024-05-03 06:43:07 -05:00
|
|
|
|
2024-06-04 08:33:55 -05:00
|
|
|
import { ExportForm } from './ExportForm';
|
2024-05-31 04:25:32 -05:00
|
|
|
import { ExporterProgress } from './ExporterProgress';
|
2024-06-04 08:33:55 -05:00
|
|
|
import { PluginReload } from './PluginReload';
|
2024-05-03 06:43:07 -05:00
|
|
|
|
|
|
|
export const PenpotExporter = () => {
|
2024-10-18 06:34:10 -05:00
|
|
|
const { loading, needsReload, exporting, error } = useFigmaContext();
|
2024-05-03 06:43:07 -05:00
|
|
|
|
2024-05-31 06:28:44 -05:00
|
|
|
if (loading) return <LoadingIndicator />;
|
|
|
|
|
2024-06-04 08:33:55 -05:00
|
|
|
if (exporting) return <ExporterProgress />;
|
2024-05-09 05:56:45 -05:00
|
|
|
|
2024-06-04 08:33:55 -05:00
|
|
|
if (needsReload) return <PluginReload />;
|
2024-05-03 06:43:07 -05:00
|
|
|
|
2024-10-18 06:34:10 -05:00
|
|
|
if (error) return <LibraryError />;
|
|
|
|
|
2024-06-04 08:33:55 -05:00
|
|
|
return <ExportForm />;
|
2024-05-03 06:43:07 -05:00
|
|
|
};
|