aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/Pin.svelte
blob: 8f33a7f3342e25344ba247ad398485c81e9e2870 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<script>
	import { tick } from 'svelte';
	import { pin } from '$lib/store';
	import { Pincode, PincodeInput } from 'svelte-pincode';
	let pinCode = [];
	let pinInput;

	$: pinInput && tick().then(pinInput && pinInput.focusFirstInput);
	$: pinCode.length > 5 && ($pin = pinCode.join(''));
</script>

<div class="fixed inset-0 bg-gray-600 bg-opacity-50 overflow-y-auto h-full w-full z-20">
	<div class="relative top-1/3 mx-auto p-5 border w-96 shadow-lg rounded-md bg-white space-y-5">
		<h1 class="text-center text-2xl font-semibold">Please enter your PIN</h1>
		<div class="text-center">
			<Pincode bind:code={pinCode} bind:this={pinInput}>
				<PincodeInput />
				<PincodeInput />
				<PincodeInput />
				<PincodeInput />
				<PincodeInput />
				<PincodeInput />
			</Pincode>
		</div>

		<div class="w-full flex">
			<button
				type="submit"
				class="border-2 border-black rounded-xl font-semibold mx-auto py-3 w-40 hover:opacity-80 mx-auto"
			>
				<div class="my-auto">Cancel</div>
			</button>
		</div>
	</div>
</div>