asi-calculator/components/Strategies/Swap/Swap.tsx

32 lines
884 B
TypeScript
Raw Normal View History

2024-03-31 16:48:31 +02:00
'use client'
import stylesShared from '../styles.module.css'
import { useState } from 'react'
import { useDebounce } from 'use-debounce'
import { FormAmount } from '@/components/FormAmount'
import { SwapResults } from './Results'
import { TokenSymbol } from '@/types'
export function Swap() {
const [amount, setAmount] = useState(100)
const [debouncedAmount] = useDebounce(amount, 500)
2024-03-31 23:50:43 +02:00
const [tokenSymbol, setTokenSymbol] = useState<TokenSymbol>('OCEAN')
2024-03-31 16:48:31 +02:00
return (
<div className={stylesShared.results}>
<h3 className={stylesShared.title}>
Holding or swapping{' '}
<FormAmount
amount={amount}
2024-03-31 23:50:43 +02:00
token={tokenSymbol}
2024-03-31 16:48:31 +02:00
setAmount={setAmount}
2024-03-31 23:50:43 +02:00
setToken={setTokenSymbol}
2024-03-31 16:48:31 +02:00
/>{' '}
right now gets you:
</h3>
2024-03-31 23:50:43 +02:00
<SwapResults tokenSymbol={tokenSymbol} amount={debouncedAmount} />
2024-03-31 16:48:31 +02:00
</div>
)
}