Update return type for Facebook verification
This commit is contained in:
parent
f6dc60eb08
commit
e22a8e8d98
7 changed files with 939 additions and 475 deletions
42
packages/bridge-ui/components/QRCode.tsx
Normal file
42
packages/bridge-ui/components/QRCode.tsx
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import { FC, useEffect, useState } from "react";
|
||||
import QRCodeInternal from "react-qr-code";
|
||||
import { Box } from "@mui/material";
|
||||
import { colors } from "../styles/theme";
|
||||
|
||||
type QRCodeProps = {
|
||||
name: string;
|
||||
label: string;
|
||||
id: string;
|
||||
helperText?: string;
|
||||
getValue?: (id: string) => Promise<string>;
|
||||
refreshInterval?: number;
|
||||
};
|
||||
|
||||
export const QRCode: FC<QRCodeProps> = ({
|
||||
name,
|
||||
label,
|
||||
id,
|
||||
helperText,
|
||||
getValue,
|
||||
refreshInterval,
|
||||
}) => {
|
||||
const [value, setValue] = useState("");
|
||||
const { white } = colors;
|
||||
|
||||
useEffect(() => {
|
||||
if (getValue && refreshInterval) {
|
||||
const interval = setInterval(async () => {
|
||||
const result = await getValue(id);
|
||||
setValue(result);
|
||||
}, refreshInterval);
|
||||
return () => clearInterval(interval);
|
||||
}
|
||||
}, [getValue, refreshInterval]);
|
||||
|
||||
return (
|
||||
<Box sx={{ backgroundColor: white, m: 2 }}>
|
||||
<QRCodeInternal value={value} />
|
||||
<Box>{helperText}</Box>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue