https://codesandbox.io/s/strange-elion-h5rhr?file=/src/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getImageDimension(imgUrl) { | |
return new Promise((resolve, reject) => { | |
if (!imgUrl) { | |
reject({ | |
status: "FAILURE" | |
}); | |
} | |
try { | |
const img = new Image(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"workbench.fontAliasing": "antialiased", | |
"window.zoomLevel": 3, | |
"[javascript]": { | |
"editor.defaultFormatter": "esbenp.prettier-vscode" | |
}, | |
"editor.formatOnSave": true, | |
"eslint.validate": ["javascript", "javascriptreact"], | |
"eslint.codeAction.showDocumentation": { | |
"enable": true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# https://stackoverflow.com/questions/31992627/git-pre-commit-hook-error-color | |
# COLOR CODES | |
red='\033[0;41m' | |
white='\033[0;47m' | |
green='\033[0;32m' | |
yellow='\033[0;33m' | |
no_color='\033[0m' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function useQRCodeScan({ | |
qrcodeMountNodeID = "", | |
closeAfterScan = true, | |
getQrBoxDimension, | |
}) { | |
const [decodedQRData, setDecodedQrData] = useState({ | |
isScanning: false, | |
isScanSuccess: false, | |
isScanFailure: false, | |
data: null, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, useEffect } from "react"; | |
import styled from "styled-components"; | |
import PropTypes from "prop-types"; | |
function getCustomIdname(props) { | |
return props.uniqueContainerId ? `-${props.uniqueContainerId}` : "-"; | |
} | |
export const PDFViewCustomContainer = styled.div` | |
// default css, not add it here to avoif large gist | |
${(props) => props.styles || ""} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, useEffect } from "react"; | |
import styled from "styled-components"; | |
import PropTypes from "prop-types"; | |
// import './previewtest.css'; | |
function getCustomIdname(props) { | |
return props.uniqueContainerId ? `-${props.uniqueContainerId}` : "-"; | |
} | |
export const PDFViewCustomContainer = styled.div` | |
header { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, useEffect } from "react"; | |
import styled from "styled-components"; | |
import PropTypes from "prop-types"; | |
// import './previewtest.css'; | |
function getCustomIdname(props) { | |
return props.uniqueContainerId ? `-${props.uniqueContainerId}` : "-"; | |
} | |
export const PDFViewCustomContainer = styled.div` | |
header { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function PdfPreview(props) { | |
const { docUrl, uniqueContainerId = "pdf-preview", styles } = props; | |
useEffect(() => { | |
// Plain javascript mozilla pdf.js initialization code can be placed here | |
}, [docUrl]); | |
return ( | |
<PDFViewCustomContainer | |
styles={styles} | |
uniqueContainerId={uniqueContainerId} |
NewerOlder