1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2025-04-20 08:16:38 +02:00

Refactor button click handlers to simplify event handling in WiFiQRCode

This commit is contained in:
Aleksandr Gumroian 2025-04-16 16:44:07 +02:00
parent a174d6a612
commit 4b58e96f71
No known key found for this signature in database
GPG Key ID: 9E77849C64F0A733

View File

@ -33,10 +33,7 @@ export default function WiFiQRCode({ SSID, password }) {
<button
type="button"
className="input-group-text"
onClick={(e) => {
e.preventDefault();
setModal(true);
}}
onClick={() => setModal(true)}
>
<FontAwesomeIcon
icon="fa-solid fa-qrcode"
@ -45,14 +42,14 @@ export default function WiFiQRCode({ SSID, password }) {
className="text-secondary"
/>
</button>
{modal ? (
{modal && (
<QRCodeModal
setShown={setModal}
shown={modal}
SSID={SSID}
password={password}
/>
) : null}
)}
</>
);
}
@ -86,19 +83,13 @@ function QRCodeModal({ shown, setShown, SSID, password }) {
<ModalFooter>
<Button
className="btn-secondary"
onClick={(e) => {
e.preventDefault();
setShown(false);
}}
onClick={() => setShown(false)}
>
{_("Close")}
</Button>
<Button
className="btn-primary"
onClick={(e) => {
e.preventDefault();
createAndDownloadPdf(SSID, password);
}}
onClick={() => createAndDownloadPdf(SSID, password)}
>
<FontAwesomeIcon
icon="fa-solid fa-file-download"