mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2025-01-03 05:10:13 -05:00
4b711b3526
* Refactor context * fix * fix
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import { LoadingIndicator } from '@create-figma-plugin/ui';
|
|
|
|
import { useFigmaContext } from '@ui/context';
|
|
|
|
import { Stack } from './Stack';
|
|
|
|
export const ExporterProgress = () => {
|
|
const { currentNode, totalPages, processedPages, downloading } = useFigmaContext();
|
|
|
|
const truncateText = (text: string, maxChars: number) => {
|
|
if (text.length <= maxChars) {
|
|
return text;
|
|
}
|
|
|
|
return text.slice(0, maxChars) + '...';
|
|
};
|
|
|
|
return (
|
|
<Stack space="small" horizontalAlign="center">
|
|
<LoadingIndicator />
|
|
<span style={{ textAlign: 'center' }}>
|
|
{!downloading ? (
|
|
<>
|
|
{processedPages} of {totalPages} pages exported 💪
|
|
{currentNode ? (
|
|
<>
|
|
<br />
|
|
Currently exporting layer
|
|
<br />
|
|
{'“' + truncateText(currentNode, 35) + '”'}
|
|
</>
|
|
) : undefined}
|
|
</>
|
|
) : (
|
|
<>
|
|
Generating Penpot file 🚀
|
|
<br />
|
|
Please wait, this process might take a while...
|
|
</>
|
|
)}
|
|
</span>
|
|
</Stack>
|
|
);
|
|
};
|