Skip to content

Commit

Permalink
added message
Browse files Browse the repository at this point in the history
  • Loading branch information
juanpms2 committed Oct 4, 2023
1 parent d63d44b commit 7ee4400
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export const ExportConfig: React.FC<Props> = props => {
const [exportHTMLSettings, setExportHTMLSettings] = React.useState<ExportHTMLSettings>({
primaryColor: theme.palette.primary[600],
});
const [isDownload, setIsDownload] = React.useState<boolean>(false);

const [htmlPreview, setHtmlPreview] = React.useState<string>(
onHTMLSettingSelectionChanged(htmlTemplate, exportHTMLSettings)
);
Expand All @@ -24,11 +26,15 @@ export const ExportConfig: React.FC<Props> = props => {
onHTMLSettingSelectionChanged(htmlTemplate, { primaryColor: event.target.value });
};
const handleExportConfigSelection = () => {
setIsDownload(true);
onExportToHTML(exportHTMLSettings);

setTimeout(() => {
cancelExport();
}, 2500);
};

React.useEffect(() => {
console.log('exportHTMLSettings', exportHTMLSettings);
setHtmlPreview(onHTMLSettingSelectionChanged(htmlTemplate, exportHTMLSettings));
}, [exportHTMLSettings]);

Expand Down Expand Up @@ -90,13 +96,21 @@ export const ExportConfig: React.FC<Props> = props => {
<p className={`${classes.title}`}>Ejemplo de previsualización</p>
<iframe id="iframeCV" className={classes.iframeCV} srcDoc={htmlPreview}></iframe>
<div className={classes.buttonContainer}>
<Button onClick={handleExportConfigSelection} showIcon={false} className={classes.buttonStyle}>
<Button
onClick={handleExportConfigSelection}
showIcon={false}
className={classes.buttonStyle}
disabled={isDownload}
>
DESCARGAR
</Button>
<Button onClick={cancelExport} showIcon={false} className={classes.buttonStyle}>
<Button onClick={cancelExport} showIcon={false} className={classes.buttonStyle} disabled={isDownload}>
CANCELAR
</Button>
</div>
{isDownload && (
<div className={classes.downloadMessage}>Descarga completada. Revisa tu carpeta de descargas</div>
)}
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export const colorFieldset = css`
@media (min-width: 1024px) {
justify-content: start;
}
`;
export const inputRadioButton = (color: string) => css`
appearance: none;
Expand Down Expand Up @@ -85,8 +84,27 @@ export const buttonContainer = css`
export const buttonStyle = css`
max-width: 358px;
min-width: min-content;
widht: 100%;
width: 100%;
@media (min-width: 1024px) {
width:auto;
width: auto;
}
`;

export const downloadMessage = css`
display: flex;
flex-direction: column;
align-items: center;
gap: ${theme.spacing(4)};
padding: ${theme.spacing(4)};
color: ${theme.palette.success[500]};
background-color: ${theme.palette.dark[500]};
${theme.typography.mobile.h5};
@media (min-width: 725px) {
${theme.typography.tablet.h5};
}
@media (min-width: 1024px) {
${theme.typography.desktop.h5};
}
`;

0 comments on commit 7ee4400

Please sign in to comment.