11<script lang =" ts" >
2- import { InputPin } from " $lib/ui" ;
2+ import { ButtonAction , Drawer , InputPin } from " $lib/ui" ;
3+ import { CircleLock01Icon } from " @hugeicons/core-free-icons" ;
4+ import { HugeiconsIcon } from " @hugeicons/svelte" ;
35
46let currentPin = $state (" " );
57let newPin = $state (" " );
68let repeatPin = $state (" " );
79let isError = $state (false );
10+ let showDrawer = $state (false );
811
9- $effect (() => {
12+ const handleClose = async () => {
13+ // close functionality goes here.
14+ showDrawer = false ;
15+ };
16+
17+ const handleChangePIN = async () => {
1018 if (repeatPin .length === 4 && newPin !== repeatPin ) isError = true ;
11- else isError = false ;
19+ if (! isError ) showDrawer = true ;
20+ };
21+
22+ $effect (() => {
23+ if (repeatPin .length === 4 && newPin === repeatPin ) isError = false ;
1224});
1325 </script >
1426
15- <main class =" h-[100vh] pt-[3vh] px-[5vw] pb-[4.5vh] flex flex-col gap-[3vh]" >
16- <div >
17- <p class =" mb-[1vh]" >Enter you current PIN</p >
18- <InputPin bind:pin ={currentPin } variant =" sm" />
19- </div >
20- <div >
21- <p class =" mb-[1vh]" >Enter your new PIN</p >
22- <InputPin bind:pin ={newPin } variant =" sm" />
23- </div >
24- <div >
25- <p class =" mb-[1vh]" >Confirm new PIN</p >
26- <InputPin bind:pin ={repeatPin } variant =" sm" />
27- </div >
28- <p class ={` text-danger mt-[3.4vh] ${isError ? " block" : " hidden" } ` }>Your PIN does not match, try again.</p >
29- </main >
27+ <main class =" h-[100vh] pt-[3vh] px-[5vw] pb-[4.5vh] flex flex-col justify-between gap-[3vh]" >
28+ <section >
29+ <div >
30+ <p class =" mb-[1vh]" >Enter you current PIN</p >
31+ <InputPin bind:pin ={currentPin } variant =" sm" />
32+ </div >
33+ <div >
34+ <p class =" mb-[1vh]" >Enter your new PIN</p >
35+ <InputPin bind:pin ={newPin } variant =" sm" />
36+ </div >
37+ <div >
38+ <p class =" mb-[1vh]" >Confirm new PIN</p >
39+ <InputPin bind:pin ={repeatPin } variant =" sm" />
40+ </div >
41+ <p class ={` text-danger mt-[3.4vh] ${isError ? " block" : " hidden" } ` }>Your PIN does not match, try again.</p >
42+ </section >
43+ <ButtonAction class ="w-full" callback ={handleChangePIN }>Change PIN</ButtonAction >
44+ </main >
45+
46+ <Drawer bind:isPaneOpen ={showDrawer } isCancelRequired ={true }>
47+ <div class =" relative bg-gray w-[72px] h-[72px] rounded-[24px] flex justify-center items-center mb-[2.3vh]" >
48+ <span class =" relative z-[1]" >
49+ <HugeiconsIcon icon ={CircleLock01Icon } color =" var(--color-primary)" />
50+ </span >
51+ <img class =" absolute top-0 start-0" src =" /images/Line.svg" alt =" line" >
52+ <img class =" absolute top-0 start-0" src =" /images/Line2.svg" alt =" line" >
53+ </div >
54+ <h4 >Pin code changed!</h4 >
55+ <p class =" text-black-700 mt-[0.5vh] mb-[2.3vh]" >Your PIN has been changed.</p >
56+ <ButtonAction class ="w-full" callback ={handleClose }>Close</ButtonAction >
57+ </Drawer >
0 commit comments