asi-calculator/components/FormAmount/Inputs/InputToken.tsx

40 lines
1.0 KiB
TypeScript
Raw Normal View History

2024-03-30 20:50:51 +01:00
import { Dispatch, SetStateAction } from 'react'
import styles from './InputToken.module.css'
import { CaretDownIcon } from '@radix-ui/react-icons'
2024-03-31 16:48:31 +02:00
import { TokenSymbol } from '@/types'
2024-03-30 20:50:51 +01:00
export function InputToken({
token,
setToken,
isFiat
}: {
2024-03-31 16:48:31 +02:00
token: TokenSymbol | string
2024-03-30 20:50:51 +01:00
isFiat?: boolean
2024-03-31 16:48:31 +02:00
setToken?: Dispatch<SetStateAction<TokenSymbol>>
2024-03-30 20:50:51 +01:00
}) {
return (
<span className={styles.selectWrapper}>
<select
className={styles.select}
2024-03-31 16:48:31 +02:00
onChange={(e) =>
setToken ? setToken(e.target.value as TokenSymbol) : null
}
2024-03-30 20:50:51 +01:00
value={token}
disabled={!setToken}
2024-03-30 20:53:39 +01:00
style={setToken ? { paddingRight: '1.25rem' } : {}}
2024-03-30 20:50:51 +01:00
>
{isFiat ? (
2024-03-31 16:48:31 +02:00
<option value="USD">USD</option>
2024-03-30 20:50:51 +01:00
) : (
<>
2024-03-31 16:48:31 +02:00
<option value="OCEAN">OCEAN</option>
<option value="FET">FET</option>
<option value="AGIX">AGIX</option>
2024-03-30 20:50:51 +01:00
</>
)}
</select>
{setToken ? <CaretDownIcon className={styles.icon} /> : null}
</span>
)
}