|
@@ -1,5 +1,5 @@
|
|
|
import React from "react";
|
|
|
-import { toBlob, toPng,toSvg } from "html-to-image";
|
|
|
+import { toBlob, toPng, toSvg } from "html-to-image";
|
|
|
import { TwitterPicker } from "react-color";
|
|
|
import { TwitterPickerStylesProps } from "react-color/lib/components/twitter/Twitter";
|
|
|
import toast from "react-hot-toast";
|
|
@@ -93,10 +93,10 @@ const StyledColorIndicator = styled.div<{ color: string }>`
|
|
|
|
|
|
enum Extensions {
|
|
|
svg,
|
|
|
- png
|
|
|
+ png,
|
|
|
}
|
|
|
export const DownloadModal: React.FC<ModalProps> = ({ visible, setVisible }) => {
|
|
|
- const [extension, setExtension] = React.useState(Extensions.svg)
|
|
|
+ const [extension, setExtension] = React.useState(Extensions.svg);
|
|
|
const [fileDetails, setFileDetails] = React.useState({
|
|
|
filename: "jsoncrack.com",
|
|
|
backgroundColor: "transparent",
|
|
@@ -137,7 +137,7 @@ export const DownloadModal: React.FC<ModalProps> = ({ visible, setVisible }) =>
|
|
|
|
|
|
const imageElement = document.querySelector("svg[id*='ref']") as HTMLElement;
|
|
|
|
|
|
- let exportImage = extension === Extensions.svg ? toSvg : toPng
|
|
|
+ let exportImage = extension === Extensions.svg ? toSvg : toPng;
|
|
|
|
|
|
const dataURI = await exportImage(imageElement, {
|
|
|
quality: fileDetails.quality,
|
|
@@ -166,9 +166,9 @@ export const DownloadModal: React.FC<ModalProps> = ({ visible, setVisible }) =>
|
|
|
<FileInput
|
|
|
value={fileDetails.filename}
|
|
|
onChange={e => updateDetails("filename", e.target.value)}
|
|
|
- setExtension={(ext:number)=> setExtension(ext)}
|
|
|
+ setExtension={setExtension}
|
|
|
activeExtension={extension}
|
|
|
- extensions={Object.keys(Extensions).filter((v) => isNaN(Number(v)))}
|
|
|
+ extensions={Object.keys(Extensions).filter(v => isNaN(Number(v)))}
|
|
|
/>
|
|
|
</StyledColorWrapper>
|
|
|
</StyledContainer>
|