156 lines
5.8 KiB
TypeScript
156 lines
5.8 KiB
TypeScript
"use client";
|
|
|
|
import { useState } from "react";
|
|
import Image from "next/image";
|
|
import { Modal, ModalContent, Button } from "@heroui/react";
|
|
import { buttonStyles } from "@/lib/buttonStyles";
|
|
|
|
interface ConfirmModalProps {
|
|
isOpen: boolean;
|
|
onClose: () => void;
|
|
}
|
|
|
|
export default function ConfirmModal({ isOpen, onClose }: ConfirmModalProps) {
|
|
const [activeTab, setActiveTab] = useState<"buy" | "sell">("buy");
|
|
|
|
return (
|
|
<Modal
|
|
isOpen={isOpen}
|
|
onClose={onClose}
|
|
size="lg"
|
|
classNames={{
|
|
base: "bg-transparent shadow-none",
|
|
wrapper: "items-center justify-center",
|
|
}}
|
|
>
|
|
<ModalContent className="bg-bg-surface dark:bg-gray-800 rounded-3xl p-6 max-w-[494px]">
|
|
<div className="flex flex-col gap-6">
|
|
{/* Header - Buy/Sell Tabs */}
|
|
<div className="flex items-center gap-8">
|
|
<button
|
|
onClick={() => setActiveTab("buy")}
|
|
className={`text-heading-h4 leading-[140%] ${
|
|
activeTab === "buy"
|
|
? "font-bold text-text-primary dark:text-white"
|
|
: "font-medium text-text-tertiary dark:text-gray-400"
|
|
}`}
|
|
>
|
|
Buy
|
|
</button>
|
|
<button
|
|
onClick={() => setActiveTab("sell")}
|
|
className={`text-heading-h4 leading-[140%] ${
|
|
activeTab === "sell"
|
|
? "font-bold text-text-primary dark:text-white"
|
|
: "font-medium text-text-tertiary dark:text-gray-400"
|
|
}`}
|
|
>
|
|
Sell
|
|
</button>
|
|
</div>
|
|
|
|
{/* PAY Section */}
|
|
<div className="flex flex-col gap-2">
|
|
{/* PAY Label and MAX Button */}
|
|
<div className="flex items-center justify-between">
|
|
<span className="text-body-small font-bold text-text-secondary dark:text-gray-400">
|
|
PAY
|
|
</span>
|
|
<Button size="sm" className="rounded-lg h-7 px-3 text-caption-tiny font-medium bg-content2 text-foreground hover:bg-content3">
|
|
MAX
|
|
</Button>
|
|
</div>
|
|
|
|
{/* Payment Input Box */}
|
|
<div className="bg-bg-subtle dark:bg-gray-700 rounded-2xl p-6">
|
|
<div className="flex items-center justify-between">
|
|
{/* Left - Amount */}
|
|
<div className="flex flex-col gap-3">
|
|
<div className="text-[32px] font-bold leading-[130%] tracking-[-0.01em] text-text-primary dark:text-white">
|
|
1,000
|
|
</div>
|
|
<div className="text-body-small font-medium text-text-tertiary dark:text-gray-400">
|
|
$10,000.00 USD
|
|
</div>
|
|
</div>
|
|
|
|
{/* Right - Token Selector and Balance */}
|
|
<div className="flex flex-col gap-3 items-end">
|
|
<button className="bg-bg-surface dark:bg-gray-600 rounded-full border border-border-normal dark:border-gray-500 px-2 h-[46px] flex items-center gap-2">
|
|
<Image
|
|
src="/usd-coin-usdc-logo-10.svg"
|
|
alt="USDC"
|
|
width={32}
|
|
height={32}
|
|
/>
|
|
<span className="text-body-default font-bold text-text-primary dark:text-white">
|
|
USDC
|
|
</span>
|
|
<Image src="/icon0.svg" alt="" width={20} height={20} />
|
|
</button>
|
|
<div className="flex items-center gap-1">
|
|
<Image src="/icon1.svg" alt="" width={12} height={12} />
|
|
<span className="text-caption-tiny font-medium text-text-secondary dark:text-gray-400">
|
|
45,230.00 USDC
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{/* Transaction Summary */}
|
|
<div className="bg-bg-subtle dark:bg-gray-700 rounded-2xl p-4 flex flex-col gap-2">
|
|
<div className="text-body-small font-medium text-text-secondary dark:text-gray-400">
|
|
Transaction Summary
|
|
</div>
|
|
|
|
{/* You Get */}
|
|
<div className="flex items-center justify-between">
|
|
<span className="text-body-small font-regular text-text-tertiary dark:text-gray-400">
|
|
You Get
|
|
</span>
|
|
<span className="text-body-small font-bold text-[#ff6900] dark:text-orange-400">
|
|
9652.2 GYUS
|
|
</span>
|
|
</div>
|
|
|
|
{/* Market Price */}
|
|
<div className="flex items-center justify-between">
|
|
<span className="text-body-small font-regular text-text-tertiary dark:text-gray-400">
|
|
Market Price
|
|
</span>
|
|
<span className="text-body-small font-bold text-text-primary dark:text-white">
|
|
$1.03 USDC
|
|
</span>
|
|
</div>
|
|
|
|
{/* Price vs Mint */}
|
|
<div className="flex items-center justify-between">
|
|
<span className="text-body-small font-regular text-text-tertiary dark:text-gray-400">
|
|
Price vs Mint
|
|
</span>
|
|
<div className="flex items-center gap-1">
|
|
<Image src="/icon2.svg" alt="" width={20} height={20} />
|
|
<span className="text-body-small font-bold text-[#10b981] dark:text-green-400">
|
|
+2.53%
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{/* Confirm Button */}
|
|
<Button
|
|
color="default"
|
|
variant="solid"
|
|
className={buttonStyles({ intent: "theme" })}
|
|
onPress={onClose}
|
|
>
|
|
Buy from SWAP
|
|
</Button>
|
|
</div>
|
|
</ModalContent>
|
|
</Modal>
|
|
);
|
|
}
|