diff --git a/components/converter/converter-card.tsx b/components/converter/converter-card.tsx
index d89cb42..5ddefa0 100644
--- a/components/converter/converter-card.tsx
+++ b/components/converter/converter-card.tsx
@@ -1,7 +1,14 @@
"use client";
import { useEffect, useMemo, useState } from "react";
-import { AlertTriangle, ArrowUpDown, Loader2, RefreshCcw } from "lucide-react";
+import {
+ AlertTriangle,
+ ArrowUpDown,
+ Check,
+ Copy,
+ Loader2,
+ RefreshCcw,
+} from "lucide-react";
import { CurrencyIcon } from "@/components/converter/currency-icon";
import { CurrencySelect } from "@/components/converter/currency-select";
@@ -117,6 +124,7 @@ export function ConverterCard({
const [amountInput, setAmountInput] = useState("1");
const [fromCode, setFromCode] = useState(DEFAULT_FROM);
const [toCode, setToCode] = useState(DEFAULT_TO);
+ const [isCopied, setIsCopied] = useState(false);
const debouncedAmount = useDebouncedValue(amountInput, 120);
@@ -195,6 +203,22 @@ export function ConverterCard({
setToCode(fromCode);
};
+ const handleCopyConvertedValue = async () => {
+ if (convertedValue === null || !toAsset) {
+ return;
+ }
+
+ const text = `${formatAmount(convertedValue, toAsset)} ${toAsset.code}`;
+
+ try {
+ await navigator.clipboard.writeText(text);
+ setIsCopied(true);
+ window.setTimeout(() => setIsCopied(false), 1400);
+ } catch {
+ setIsCopied(false);
+ }
+ };
+
if (isLoading && !data) {
return
- Converted value -
++ Converted value +
+ +