adding stylelint to repo

This commit is contained in:
Amruth Pillai
2020-10-04 08:58:01 +05:30
parent 469f53bf6e
commit a11db1db10
36 changed files with 851 additions and 43 deletions

View File

@ -4,6 +4,7 @@
.modal {
width: min(600px, calc(100vw - 100px));
@apply p-8 rounded bg-primary-50 outline-none;
}

View File

@ -4,6 +4,7 @@ import { clone } from 'lodash';
import React, { memo, useContext, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { FaPrint } from 'react-icons/fa';
import { toast } from 'react-toastify';
import Button from '../../components/shared/Button';
import ModalContext from '../../contexts/ModalContext';
import { useSelector } from '../../contexts/ResumeContext';
@ -31,22 +32,22 @@ const ExportModal = () => {
}
};
const handleSinglePageDownload = async () => {
setLoadingSingle(true);
const printResume = firebase.functions().httpsCallable('printResume');
const { data } = await printResume({ id: state.id, type: 'single' });
const blob = b64toBlob(data, 'application/pdf');
download(blob, `RxResume-${state.id}.pdf`, 'application/pdf');
setLoadingSingle(false);
};
const handleDownload = async (isSinglePDF) => {
isSinglePDF ? setLoadingSingle(true) : setLoadingMulti(true);
const handleMultiPageDownload = async () => {
setLoadingMulti(true);
const printResume = firebase.functions().httpsCallable('printResume');
const { data } = await printResume({ id: state.id, type: 'multi' });
const blob = b64toBlob(data, 'application/pdf');
download(blob, `RxResume-${state.id}.pdf`, 'application/pdf');
setLoadingMulti(false);
try {
const printResume = firebase.functions().httpsCallable('printResume');
const { data } = await printResume({
id: state.id,
type: isSinglePDF ? 'single' : 'multi',
});
const blob = b64toBlob(data, 'application/pdf');
download(blob, `RxResume-${state.id}.pdf`, 'application/pdf');
} catch (error) {
toast(t('builder.toasts.printError'));
} finally {
isSinglePDF ? setLoadingSingle(false) : setLoadingMulti(false);
}
};
const handleExportToJson = () => {
@ -93,14 +94,14 @@ const ExportModal = () => {
<div className="flex">
<Button
isLoading={isLoadingSingle}
onClick={handleSinglePageDownload}
onClick={() => handleDownload(true)}
>
{t('modals.export.downloadPDF.buttons.single')}
</Button>
<Button
className="ml-8"
isLoading={isLoadingMulti}
onClick={handleMultiPageDownload}
onClick={() => handleDownload(false)}
>
{t('modals.export.downloadPDF.buttons.multi')}
</Button>