Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

Commit

Permalink
feat: adds not enough funds atom component
Browse files Browse the repository at this point in the history
  • Loading branch information
itofarina committed Feb 1, 2021
1 parent 565dfc3 commit 2f9f01d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
14 changes: 14 additions & 0 deletions src/components/atoms/NotEnoughFunds.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import Typography from '@material-ui/core/Typography'
import React, { FC } from 'react'

export type NotEnoughFundsProps = {
currencyDisplayName: string
}

const NotEnoughFunds: FC<NotEnoughFundsProps> = ({ currencyDisplayName }) => (
<Typography color="error" align="center">
{`You do not have enough ${currencyDisplayName}`}
</Typography>
)

export default NotEnoughFunds
9 changes: 5 additions & 4 deletions src/components/organisms/storage/staking/DepositModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import React, {
import Big from 'big.js'
import { getBalance } from 'contracts/utils/accountBalance'
import { convertToWeiString } from 'utils/parsers'
import { SupportedTokenSymbol, SYSTEM_SUPPORTED_SYMBOL } from 'models/Token'
import { SupportedTokenSymbol, SYSTEM_SUPPORTED_SYMBOL, SYSTEM_TOKENS } from 'models/Token'
import NotEnoughFunds from 'components/atoms/NotEnoughFunds'
import StakedBalances from './StakedBalances'

export interface DepositModalProps {
Expand Down Expand Up @@ -142,9 +143,9 @@ const DepositModal: FC<DepositModalProps> = ({
{
isPositiveAmount && !enoughFunds
&& (
<Typography color="error" align="center">
{`You do not have enough ${selectedToken.toUpperCase()}`}
</Typography>
<NotEnoughFunds
currencyDisplayName={SYSTEM_TOKENS[selectedToken].displayName}
/>
)
}
</CenteredContent>
Expand Down

0 comments on commit 2f9f01d

Please sign in to comment.