2022-06-05 17:57:04 +00:00
|
|
|
import { h } from 'preact';
|
|
|
|
import { Modal, ModalContent } from './Modal';
|
|
|
|
|
2023-01-12 02:14:44 +00:00
|
|
|
import styles from './css/ProgressModal.module.scss';
|
2022-06-05 17:57:04 +00:00
|
|
|
|
|
|
|
export interface ErrorProps {
|
|
|
|
title: string;
|
|
|
|
current: number | undefined;
|
|
|
|
total: number | undefined;
|
|
|
|
}
|
|
|
|
|
2023-01-12 02:14:44 +00:00
|
|
|
export const ProgressModal = ({ title, current, total }: ErrorProps) => {
|
2022-06-05 17:57:04 +00:00
|
|
|
if (current && total) {
|
|
|
|
return (
|
|
|
|
<Modal title={title} isOpen={true}>
|
|
|
|
<ModalContent>
|
|
|
|
<div className={styles.progressContainer}>
|
|
|
|
<div
|
|
|
|
className={styles.progressBar}
|
2023-11-24 14:45:55 +00:00
|
|
|
style={{
|
|
|
|
width: Math.floor(320 * (current / total)),
|
|
|
|
}}
|
2022-06-05 17:57:04 +00:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</ModalContent>
|
|
|
|
</Modal>
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
};
|