-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
647 lines (609 loc) · 29.1 KB
/
index.js
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
import React from "react";
import { Fragment, useRef, useState, useEffect } from "react";
import { Button } from "flowbite-react";
import { Dialog, Transition } from "@headlessui/react";
import { ConnectButton } from "@rainbow-me/rainbowkit";
import { useAccount, useContract, useProvider, useSigner } from "wagmi";
import { payments_data } from "./constants";
import { ethers } from "ethers";
export default function SwiftPay(props) {
const [togglePayComponent, setTogglePayComponent] = useState(false);
const [togglePayNow, setTogglePayNow] = useState(false);
const [togglePayLater, setTogglePayLater] = useState(false);
const [togglePayStream, setTogglePayStream] = useState(false);
const [togglePayEMI, setTogglePayEMI] = useState(false);
const cancelButtonRef = useRef(null);
const { address, isConnected } = useAccount();
const provider = useProvider();
const { data: signer } = useSigner();
const [amount, setAmount] = useState("");
const [receiver, setReceiver] = useState("");
const [sender, setSender] = useState("");
const [tenure, setTenure] = useState("");
const Payments_Contract = useContract({
address: payments_data.address,
abi: payments_data.abi,
signerOrProvider: signer || provider,
});
useEffect(() => {
if (isConnected) {
setSender(address);
}
}, [address]);
const handlePayNow = async (_choice) => {
try {
if (_choice == 1) {
const _amount = ethers.utils.formatEther(amount.toString());
const tx = await Payments_Contract.payNow(sender, receiver, _amount, {
value: _amount,
});
await tx.wait();
} else if (_choice == 2) {
const _amount = ethers.utils.formatEther(amount.toString());
const tx = await Payments_Contract.payViaWallet(
sender,
receiver,
amount
);
await tx.wait();
} else {
console.log("Not a Valid Choice");
}
} catch (err) {
console.log(err);
}
};
const handlePayLater = async () => {
try {
console.log("Starting Pay later ...");
const _amount = ethers.utils.formatEther(amount.toString());
const time = 2592000;
const tx = await Payments_Contract.createPLRequest(
sender,
receiver,
_amount,
time
);
await tx.wait();
console.log("Pay Later started");
console.log(tx);
console.log(tx.v);
} catch (err) {
console.log(err);
}
};
const handlePayEMI = async () => {
try {
console.log("Pay EMI Started..");
const _amount = ethers.utils.formatEther(amount.toString());
const tx = await Payments_Contract.createEMI(
sender,
receiver,
_amount,
tenure
);
await tx.wait();
console.log("PayEMI completed");
} catch (err) {
console.log(err);
}
};
const handlePayStream = async () => {
try {
} catch (err) {
console.log(err);
}
};
return (
<div>
{/* payment component */}
<Button
onClick={() => {
setTogglePayComponent(!togglePayComponent);
}}
className="w-[100px] m-2 rounded-sm"
>
Pay
</Button>
{/* payment options modal */}
<Transition.Root show={togglePayComponent} as={Fragment}>
<Dialog
as="div"
className="relative z-10"
initialFocus={cancelButtonRef}
onClose={setTogglePayComponent}
>
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="ease-in duration-200"
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
<div className="fixed inset-0 bg-gray-500 bg-[#0c0c1764] bg-opacity-75 transition-opacity backdrop-blur-[40px]" />
</Transition.Child>
<div className="fixed inset-0 z-10 overflow-y-auto">
<div className="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0">
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
enterTo="opacity-100 translate-y-0 sm:scale-100"
leave="ease-in duration-200"
leaveFrom="opacity-100 translate-y-0 sm:scale-100"
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
>
<Dialog.Panel className="relative transform overflow-hidden rounded-md text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg">
<div className="bg-gradient-to-r bg-inherit textw px-4 pt-5 pb-4 sm:p-6 sm:pb-4 sm:pl-0">
<div className="sm:flex sm:items-start ">
<div className="mt-3 flex flex-col justify-center items-center text-center sm:mt-0 sm:ml-4 w-full sm:text-left">
<Dialog.Title
as="h3"
className="text-3xl mx-auto mt-4 font-semibold leading-6 mr-auto pl-4 text-gray-100 px-2"
>
Select Payment Option
</Dialog.Title>
<div className={`mt-4`}>
<div className="my-2 text-center text-lg">
Select from the four payment options offered by
SwiftFi to complete the payment
</div>
<div className="flex flex-col w-[500px] h-[350px] flex-wrap justify-center items-center px-6 py-4 rounded-md">
<Button
onClick={() => {
setTogglePayNow(!togglePayNow);
}}
className="w-[130px] py3 my-3"
>
Pay Now
</Button>
<Button
onClick={() => {
setTogglePayLater(!togglePayLater);
}}
className="w-[130px] py3 my-3"
>
Pay Later
</Button>
<Button
onClick={() => {
setTogglePayStream(!togglePayStream);
}}
className="w-[130px] py3 my-3"
>
Pay in Stream
</Button>
<Button
onClick={() => {
setTogglePayEMI(!togglePayEMI);
}}
className="w-[130px] py3 my-3"
>
Pay in EMI
</Button>
<Button
onClick={() => {
setTogglePayComponent(!togglePayComponent);
}}
ref={cancelButtonRef}
className="w-[130px] bg-red-500 hover:bg-red-600 py3 my-3"
// className={` mt-3 inline-flex rounded-md border border-transparent bg-white text-black px-4 py-2 text-base font-medium shadow-sm hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:ring-offset-2 sm:ml-3 sm:w-auto sm:text-sm`}
>
Cancel
</Button>
</div>
</div>
</div>
</div>
</div>
</Dialog.Panel>
</Transition.Child>
</div>
</div>
</Dialog>
</Transition.Root>
{/* pay now modal */}
<Transition.Root show={togglePayNow} as={Fragment}>
<Dialog
as="div"
className="relative z-10"
initialFocus={cancelButtonRef}
onClose={setTogglePayNow}
>
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="ease-in duration-200"
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
<div className="fixed inset-0 bg-gray-500 bg-[#0c0c1764] bg-opacity-75 transition-opacity backdrop-blur-[40px]" />
</Transition.Child>
<div className="fixed inset-0 z-10 overflow-y-auto">
<div className="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0">
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
enterTo="opacity-100 translate-y-0 sm:scale-100"
leave="ease-in duration-200"
leaveFrom="opacity-100 translate-y-0 sm:scale-100"
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
>
<Dialog.Panel className="relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg">
<div className="bg-gray-100 px-4 pt-5 pb-4 sm:p-6 sm:pb-4 sm:pl-0">
<div className="sm:flex sm:items-start ">
<div className="mt-3 flex flex-col justify-center items-center text-center sm:mt-0 sm:ml-4 w-full sm:text-left">
<Dialog.Title
as="h3"
className="text-3xl font-semibold leading-6 mr-auto pl-4 text-gray-900 px-2"
>
Pay Now
</Dialog.Title>
<div className="p-2 text-sm mt-2 w-full text-gray-800">
<div
className={` flex flex-col items-center justify-center w-full text-center rounded-md mt-2 p-2`}
>
<div
className={`${`text-center w-36 mr-auto font-semibold max-h-[100px] overflow-hidden rounded-md p-2 bg-gray-900 text-white`}`}
>
<ConnectButton />
</div>
</div>
<div className="w-full mt-3 mx-2">
<h2 className="my-2 text-xl">
OrderID: {` Payment ID HERE `}
</h2>
<h1 className="my-2 text-2xl font-semibold">
Amount: ${` Amount HERE `}
</h1>
</div>
</div>
</div>
</div>
</div>
<div className="bg-gray-800 px-4 py-3 sm:flex sm:flex-row sm:px-6">
<button
type="button"
className={`mt-3 inline-flex rounded-md borderborder-transparent bg-green-500 px-4 py-2 text-base font-medium text-white shadow-sm hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-green-400 focus:ring-offset-2 sm:ml-3 sm:w-auto sm:text-sm`}
>
Pay with SwiftFi Wallet
</button>
<button
type="button"
className={` mt-3 inline-flex rounded-md border border-transparent bg-green-500 px-4 py-2 text-base font-medium text-white shadow-sm hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-green-400 focus:ring-offset-2 sm:ml-3 sm:w-auto sm:text-sm`}
>
Pay with Other Wallet
</button>
<button
onClick={() => {
setTogglePayNow(!togglePayNow);
}}
ref={cancelButtonRef}
type="button"
className={` mt-3 inline-flex rounded-md border border-transparent bg-white text-black px-4 py-2 text-base font-medium shadow-sm hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:ring-offset-2 sm:ml-3 sm:w-auto sm:text-sm`}
>
Cancel
</button>
</div>
</Dialog.Panel>
</Transition.Child>
</div>
</div>
</Dialog>
</Transition.Root>
{/* pay later modal */}
<Transition.Root show={togglePayLater} as={Fragment}>
<Dialog
as="div"
className="relative z-10"
initialFocus={cancelButtonRef}
onClose={setTogglePayLater}
>
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="ease-in duration-200"
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
<div className="fixed inset-0 bg-gray-500 bg-[#0c0c1764] bg-opacity-75 transition-opacity backdrop-blur-[40px]" />
</Transition.Child>
<div className="fixed inset-0 z-10 overflow-y-auto">
<div className="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0">
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
enterTo="opacity-100 translate-y-0 sm:scale-100"
leave="ease-in duration-200"
leaveFrom="opacity-100 translate-y-0 sm:scale-100"
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
>
<Dialog.Panel className="relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg">
<div className="bg-gray-100 px-4 pt-5 pb-4 sm:p-6 sm:pb-4 sm:pl-0">
<div className="sm:flex sm:items-start ">
<div className="mt-3 flex flex-col justify-center items-center text-center sm:mt-0 sm:ml-4 w-full sm:text-left">
<Dialog.Title
as="h3"
className="text-3xl font-semibold leading-6 mr-auto pl-4 text-gray-900 px-2"
>
Pay Later
</Dialog.Title>
<div className="p-2 text-sm mt-2 w-full text-gray-800">
<div
className={` flex flex-col items-center justify-center w-full text-center rounded-md mt-2 p-2`}
>
<div
className={`${`text-center w-36 mr-auto font-semibold max-h-[100px] overflow-hidden rounded-md p-2 bg-gray-900 text-white`}`}
>
<ConnectButton />
</div>
</div>
<div className="w-full mt-3 mx-2">
<h2 className="my-2 text-xl">
OrderID: {` Payment ID HERE `}
</h2>
<h1 className="my-2 text-2xl font-semibold">
Amount: ${` Amount HERE `}
</h1>
<h2 className="my-2 text-xl">
How does Pay Later work?
</h2>
<h2 className="my-2 textlg">
- 30 days interest free period <br />
- 15% APR interest <br />- amount to be locked
</h2>
</div>
</div>
</div>
</div>
</div>
<div className="bg-gray-800 px-4 py-3 sm:flex sm:flex-row justify-end sm:px-6">
<button
type="button"
className={`mt-3 inline-flex rounded-md borderborder-transparent bg-green-500 px-4 py-2 text-base font-medium text-white shadow-sm hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-green-400 focus:ring-offset-2 sm:ml-3 sm:w-auto sm:text-sm`}
>
Start Pay Later
</button>
<button
onClick={() => {
setTogglePayLater(!togglePayLater);
}}
ref={cancelButtonRef}
type="button"
className={` mt-3 inline-flex rounded-md border border-transparent bg-white text-black px-4 py-2 text-base font-medium shadow-sm hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:ring-offset-2 sm:ml-3 sm:w-auto sm:text-sm`}
>
Cancel
</button>
</div>
</Dialog.Panel>
</Transition.Child>
</div>
</div>
</Dialog>
</Transition.Root>
{/* pay stream modal */}
<Transition.Root show={togglePayStream} as={Fragment}>
<Dialog
as="div"
className="relative z-10"
initialFocus={cancelButtonRef}
onClose={setTogglePayStream}
>
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="ease-in duration-200"
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
<div className="fixed inset-0 bg-gray-500 bg-[#0c0c1764] bg-opacity-75 transition-opacity backdrop-blur-[40px]" />
</Transition.Child>
<div className="fixed inset-0 z-10 overflow-y-auto">
<div className="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0">
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
enterTo="opacity-100 translate-y-0 sm:scale-100"
leave="ease-in duration-200"
leaveFrom="opacity-100 translate-y-0 sm:scale-100"
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
>
<Dialog.Panel className="relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg">
<div className="bg-gray-100 px-4 pt-5 pb-4 sm:p-6 sm:pb-4 sm:pl-0">
<div className="sm:flex sm:items-start ">
<div className="mt-3 flex flex-col justify-center items-center text-center sm:mt-0 sm:ml-4 w-full sm:text-left">
<Dialog.Title
as="h3"
className="text-3xl font-semibold leading-6 mr-auto pl-4 text-gray-900 px-2"
>
Pay in Stream
</Dialog.Title>
<div className="p-2 text-sm mt-2 w-full text-gray-800">
<div
className={` flex flex-col items-center justify-center w-full text-center rounded-md mt-2 p-2`}
>
<div
className={` ${`text-center mr-auto font-semibold max-h-[100px] overflow-hidden rounded-md p-2 bg-gray-900 text-white`}`}
>
<ConnectButton />
</div>
</div>
<div className="w-full mt-3 mx-2">
<h2 className="my-2 text-xl">
OrderID: {` Payment ID HERE `}
</h2>
<h1 className="my-2 text-2xl font-semibold">
Amount: ${` Amount HERE `}
</h1>
<button
type="button"
className={`my-2 inline-flex rounded-md borderborder-transparent bg-green-500 px-4 py-2 text-base font-medium text-white shadow-sm hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-green-400 focus:ring-offset-2 sm:ml-0 sm:w-auto sm:text-sm`}
>
Superfluid enabled coin Swapping and token
selection
</button>
<div className="my-2 flex flex-col flex-wrap mx-auto items-start justify-between">
<label className="pb-2 text-sm" htmlFor="">
Time Period :
</label>
<input
type="text"
className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-[5px] focus:ring-blue-500 focus:border-blue-500 w-72 p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
placeholder="Duration..."
required
/>
</div>
<h2 className="mt-4 text-xl ">
Flow Rate: {` Rate HERE `}
</h2>
<h2 className="mt-5 text-center text-xs underline ">
Streams Powered by Superfluid{" "}
</h2>
</div>
</div>
</div>
</div>
</div>
<div className="bg-gray-800 px-4 py-3 sm:flex sm:flex-row justify-end sm:px-6">
<button
type="button"
className={`mt-3 inline-flex rounded-md borderborder-transparent bg-green-500 px-4 py-2 text-base font-medium text-white shadow-sm hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-green-400 focus:ring-offset-2 sm:ml-3 sm:w-auto sm:text-sm`}
>
Start Stream
</button>
<button
onClick={() => {
setTogglePayStream(!togglePayStream);
}}
ref={cancelButtonRef}
type="button"
className={` mt-3 inline-flex rounded-md border border-transparent bg-white text-black px-4 py-2 text-base font-medium shadow-sm hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:ring-offset-2 sm:ml-3 sm:w-auto sm:text-sm`}
>
Cancel
</button>
</div>
</Dialog.Panel>
</Transition.Child>
</div>
</div>
</Dialog>
</Transition.Root>
{/* pay EMI modal */}
<Transition.Root show={togglePayEMI} as={Fragment}>
<Dialog
as="div"
className="relative z-10"
initialFocus={cancelButtonRef}
onClose={setTogglePayEMI}
>
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="ease-in duration-200"
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
<div className="fixed inset-0 bg-gray-500 bg-[#0c0c1764] bg-opacity-75 transition-opacity backdrop-blur-[40px]" />
</Transition.Child>
<div className="fixed inset-0 z-10 overflow-y-auto">
<div className="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0">
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
enterTo="opacity-100 translate-y-0 sm:scale-100"
leave="ease-in duration-200"
leaveFrom="opacity-100 translate-y-0 sm:scale-100"
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
>
<Dialog.Panel className="relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg">
<div className="bg-gray-100 px-4 pt-5 pb-4 sm:p-6 sm:pb-4 sm:pl-0">
<div className="sm:flex sm:items-start ">
<div className="mt-3 flex flex-col justify-center items-center text-center sm:mt-0 sm:ml-4 w-full sm:text-left">
<Dialog.Title
as="h3"
className="text-3xl font-semibold leading-6 mr-auto pl-4 text-gray-900 px-2"
>
Pay in EMI
</Dialog.Title>
<div className="p-2 text-sm mt-2 w-full text-gray-800">
<div
className={` flex flex-col items-center justify-center w-full text-center rounded-md mt-2 p-2`}
>
<div
className={` ${`text-center mr-auto font-semibold max-h-[100px] overflow-hidden rounded-md p-2 bg-gray-900 text-white`}`}
>
<ConnectButton />
</div>
</div>
<div className="w-full mt-3 mx-2">
<h2 className="my-2 text-xl">
OrderID: {` Payment ID HERE `}
</h2>
<h1 className="my-2 text-2xl font-semibold">
Amount: ${` Amount HERE `}
</h1>
<h2 className="my-2 text-xl">
Tenure:{" "}
<select
id="countries"
className="bg-gray-900 my-2 text-white border w-72 md:w-64 border-gray-300 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
>
<option value="3m" selected>
3 Months
</option>
<option value="6m">6 Months</option>
<option value="9m">9 Months</option>
<option value="12m">12 Months</option>
</select>
</h2>
<h2 className="my-2 text-xl">How does EMI work?</h2>
<h2 className="my-2 textlg">
- Defaults payment if not done in 30 days
<br />- 25 % interest
</h2>
</div>
</div>
</div>
</div>
</div>
<div className="bg-gray-800 px-4 py-3 sm:flex sm:flex-row justify-end sm:px-6">
<button
type="button"
className={`mt-3 inline-flex rounded-md borderborder-transparent bg-green-500 px-4 py-2 text-base font-medium text-white shadow-sm hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-green-400 focus:ring-offset-2 sm:ml-3 sm:w-auto sm:text-sm`}
>
Pay
</button>
<button
onClick={() => {
setTogglePayEMI(!togglePayEMI);
}}
ref={cancelButtonRef}
type="button"
className={` mt-3 inline-flex rounded-md border border-transparent bg-white text-black px-4 py-2 text-base font-medium shadow-sm hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:ring-offset-2 sm:ml-3 sm:w-auto sm:text-sm`}
>
Cancel
</button>
</div>
</Dialog.Panel>
</Transition.Child>
</div>
</div>
</Dialog>
</Transition.Root>
</div>
);
}