-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(token input): create TokenInput component
This is a simple component that serves as an step forward in the integration of the tokens functionalities. Nothing fancy, just a BigNumberInput wrapped.
- Loading branch information
1 parent
ba97e21
commit 3ecc4eb
Showing
2 changed files
with
62 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { useState, type FC } from 'react' | ||
|
||
import { Text } from 'db-ui-toolkit' | ||
import * as chains from 'viem/chains' | ||
|
||
import { BigNumberInput } from '@/src/sharedComponents/BigNumberInput' | ||
import { type Token } from '@/src/token' | ||
|
||
const TokenInput: FC<{ token?: Token }> = ({ token }) => { | ||
const [amount, setAmount] = useState('') | ||
|
||
return token ? ( | ||
<> | ||
<Text> | ||
Selected token:{' '} | ||
<strong> | ||
{token.symbol} ({Object.values(chains).find(({ id }) => id === token.chainId)?.name}) | ||
</strong> | ||
</Text> | ||
<BigNumberInput decimals={token.decimals} onChange={setAmount} value={amount} /> | ||
</> | ||
) : ( | ||
<input disabled placeholder="nothing to see here..." /> | ||
) | ||
} | ||
|
||
export default TokenInput |