import React, { useState } from "react";
import "./QRModal.css";
import { Button, Input, QRCode, Space } from "antd";
const PLAY_STORE_LINK =
"https://play.google.com/store/apps/details?id=com.rkdholdings.psms&hl=en_IE";
/**
* A QR modal component for displaying and copying a QR code.
* @returns {JSX.Element} The rendered component.
*/
const QRModal = () => {
const [copySuccess, setCopySuccess] = useState(false);
const handleCopyClick =()=>{
navigator.clipboard.writeText(PLAY_STORE_LINK)
setCopySuccess(true);
setTimeout(() => setCopySuccess(false), 2000);
}
return (
<Space direction="vertical" align="center">
<QRCode value={PLAY_STORE_LINK || "-"} />
<Button onClick={handleCopyClick}>Copy link</Button>
{copySuccess && <p>Copied to clipboard!</p>}
</Space>
);
};
export default QRModal;
Source