Add QR generation

This commit is contained in:
Nicholas Jitkoff 2023-02-11 14:48:44 -07:00
parent 43ddd710ee
commit 207d0f538e
3 changed files with 31 additions and 1 deletions

View file

@ -1,3 +1,4 @@
import * as bitty from '/bitty.js';
class Menu {
/**
* @constructor
@ -17,7 +18,27 @@ class Menu {
}
makeQR() {
bitty.loadScript('/js/qrious.min.js', null, "").then(() => {
console.log("qrious loaded", location.href);
let qrDialog = el("dialog#qr-dialog.dialog",
el("canvas", {id: "qr"}),
el("div", document.title)
);
qrDialog.onclick = () => {
qrDialog.close();
qrDialog.parentNode.removeChild(qrDialog)
}
document.body.append(qrDialog);
qrDialog.showModal();
var qr = new QRious({
element: document.getElementById("qr"),
background: 'transparent',
foreground: 'currentColor',
size: 500,
value: location.href,
});
})
}
sendEmail() {
console.log("url", location.href)

View file

@ -623,6 +623,7 @@ export {
pathToMetadata,
parseBittyURL,
el,
loadScript,
BASE64_MARKER,
LZMA64_MARKER,
BASE_MARKER,

View file

@ -279,6 +279,7 @@ body:not(.loading) #loader {
box-shadow: 0 0 0 2px black, inset 0 0 0 3px black;
min-width: 300px;
padding: 1.2em;
display:flex;
}
.dialog, .dialog button {font-size: 18px;font-weight: 600;font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";}
@ -287,6 +288,13 @@ dialog::backdrop {
/* repeating-conic-gradient(rgba(255,255,255,.5) 0% 25%, transparent 0% 50%) 50% / 4px 4px; */
}
dialog#qr-dialog {
display: flex;
flex-direction: column;
}
dialog#qr-dialog div {
text-align: center;
}
.dialog button {
border: 1px solid white;