mirror of
https://gitlab.nic.cz/turris/reforis/foris-js.git
synced 2025-04-19 08:06:40 +02:00
Refactor button click handlers to simplify event handling in WiFiQRCode
This commit is contained in:
parent
a174d6a612
commit
4b58e96f71
@ -33,10 +33,7 @@ export default function WiFiQRCode({ SSID, password }) {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="input-group-text"
|
className="input-group-text"
|
||||||
onClick={(e) => {
|
onClick={() => setModal(true)}
|
||||||
e.preventDefault();
|
|
||||||
setModal(true);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon="fa-solid fa-qrcode"
|
icon="fa-solid fa-qrcode"
|
||||||
@ -45,14 +42,14 @@ export default function WiFiQRCode({ SSID, password }) {
|
|||||||
className="text-secondary"
|
className="text-secondary"
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
{modal ? (
|
{modal && (
|
||||||
<QRCodeModal
|
<QRCodeModal
|
||||||
setShown={setModal}
|
setShown={setModal}
|
||||||
shown={modal}
|
shown={modal}
|
||||||
SSID={SSID}
|
SSID={SSID}
|
||||||
password={password}
|
password={password}
|
||||||
/>
|
/>
|
||||||
) : null}
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -86,19 +83,13 @@ function QRCodeModal({ shown, setShown, SSID, password }) {
|
|||||||
<ModalFooter>
|
<ModalFooter>
|
||||||
<Button
|
<Button
|
||||||
className="btn-secondary"
|
className="btn-secondary"
|
||||||
onClick={(e) => {
|
onClick={() => setShown(false)}
|
||||||
e.preventDefault();
|
|
||||||
setShown(false);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{_("Close")}
|
{_("Close")}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
className="btn-primary"
|
className="btn-primary"
|
||||||
onClick={(e) => {
|
onClick={() => createAndDownloadPdf(SSID, password)}
|
||||||
e.preventDefault();
|
|
||||||
createAndDownloadPdf(SSID, password);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon="fa-solid fa-file-download"
|
icon="fa-solid fa-file-download"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user