mirror of
https://github.com/kremalicious/asi-calculator.git
synced 2024-12-23 01:39:40 +01:00
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
import { Dispatch, SetStateAction } from 'react'
|
|
import styles from './InputToken.module.css'
|
|
import { CaretDownIcon } from '@radix-ui/react-icons'
|
|
import { TokenSymbol } from '@/types'
|
|
|
|
export function InputToken({
|
|
token,
|
|
setToken,
|
|
isFiat
|
|
}: {
|
|
token: TokenSymbol | string
|
|
isFiat?: boolean
|
|
setToken?: Dispatch<SetStateAction<TokenSymbol>>
|
|
}) {
|
|
return (
|
|
<span className={styles.selectWrapper}>
|
|
<select
|
|
className={styles.select}
|
|
onChange={(e) =>
|
|
setToken ? setToken(e.target.value as TokenSymbol) : null
|
|
}
|
|
value={token}
|
|
disabled={!setToken}
|
|
style={setToken ? { paddingRight: '1.25rem' } : {}}
|
|
>
|
|
{isFiat ? (
|
|
<option value="USD">USD</option>
|
|
) : (
|
|
<>
|
|
<option value="OCEAN">OCEAN</option>
|
|
<option value="FET">FET</option>
|
|
<option value="AGIX">AGIX</option>
|
|
</>
|
|
)}
|
|
</select>
|
|
{setToken ? <CaretDownIcon className={styles.icon} /> : null}
|
|
</span>
|
|
)
|
|
}
|