-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
balaktsisc
committed
Feb 29, 2024
1 parent
f9e76d2
commit 86b4e1d
Showing
2 changed files
with
48 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,60 @@ | ||
<script lang='ts'> | ||
import { onMount } from 'svelte'; | ||
// import QRCode from 'qrcode-generator'; | ||
import QRCode from 'qrcode' | ||
import type { qrItem } from './qrItem'; | ||
import { alertController } from 'ionic-svelte'; | ||
import { qrStore } from './qrStore'; | ||
import { goto } from '$app/navigation'; | ||
import { reload } from 'ionicons/icons'; | ||
export let qr1: qrItem; | ||
onMount(() => { | ||
const qrCodeElement = document.getElementById(qr1.data); | ||
QRCode.toCanvas(qrCodeElement, qr1.data, { width: 200, height: 200 }); | ||
}); | ||
const showAlert = async (options) => { | ||
const alert = await alertController.create(options); | ||
await alert.present(); | ||
}; | ||
function deleteQR() { | ||
const options = { | ||
header: 'Αφαίρεση QR;', | ||
message: 'Θέλεις να αφαιρεθεί το QR από το πορτοφόλι σου;', | ||
buttons: [{ | ||
text: 'ΟΧΙ', | ||
role: 'cancel', | ||
handler: () => { | ||
return; | ||
} | ||
}, | ||
{ | ||
text: 'ΝΑΙ', | ||
role: 'confirm', | ||
handler: () => { | ||
qrStore.update((store) => store.filter((item) => item.data !== qr1.data)); | ||
} | ||
}] | ||
}; | ||
showAlert(options); | ||
} | ||
</script> | ||
|
||
|
||
<div style="display: flex; flex-direction: column; align-items: center;"> | ||
<ion-label>{qr1.title}</ion-label> | ||
<canvas style="padding:0; margin:0;" id="{qr1.data}"></canvas> | ||
</div> | ||
<!-- svelte-ignore a11y-click-events-have-key-events --> | ||
<!-- svelte-ignore a11y-no-static-element-interactions --> | ||
<ion-div on:click={deleteQR}> | ||
<canvas id="{qr1.data}"></canvas> | ||
<ion-label>{qr1.title}</ion-label> | ||
</ion-div> | ||
|
||
<style> | ||
ion-div { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -282,4 +282,4 @@ | |
justify-content: center; | ||
align-items: center; | ||
} | ||
</style> | ||
</style> |