aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/Qr.svelte
blob: da4ceb00ed6c0be7c90199b0886ee766bf372f2e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<script>
  import screenfull from "screenfull";
  let { icon, text } = $props();
  let qr = $state();

  let src = `/qr/${encodeURIComponent(text)}`;
  if (icon) src += `/${icon}`;
  else src += "/raw";
</script>

<div
  class="w-72 sm:w-80 mx-auto cursor-pointer"
  bind:this={qr}
  onclick={() => screenfull.toggle(qr)}
  onkeydown={() => screenfull.toggle(qr)}
>
  <img {src} class="mx-auto" alt="QR Code" />
</div>