import React from 'react'; import styled from 'styled-components'; import {Button, Card} from '@material-ui/core'; import CardContent from '../../../components/CardContent'; import Label from '../../../components/Label'; import TokenSymbol from '../../../components/TokenSymbol'; import useModal from '../../../hooks/useModal'; import ExchangeModal from './ExchangeModal'; import ERC20 from '../../../unicorn-finance/ERC20'; import useTokenBalance from '../../../hooks/useTokenBalance'; interface ExchangeCardProps { action: string; fromToken: ERC20; fromTokenName: string; toToken: ERC20; toTokenName: string; priceDesc: string; onExchange: (amount: string) => void; disabled?: boolean; disabledDescription?: string; } const ExchangeCard: React.FC = ({ action, fromToken, fromTokenName, toToken, toTokenName, priceDesc, onExchange, disabled = false, disabledDescription, }) => { const balance = useTokenBalance(fromToken); const [onPresent, onDismiss] = useModal( { onExchange(value); onDismiss(); }} action={action} tokenName={fromTokenName} />, ); return ( {`Send UNICORN to enter the raffle`} {priceDesc} ); }; const StyledCardTitle = styled.div` align-items: center; display: flex; font-size: 20px; font-weight: 700; height: 64px; justify-content: center; color: #ccf; margin-top: ${(props) => -props.theme.spacing[3]}px; `; const StyledCardIcon = styled.div` background-color: rgba(0,0,0,0.2); width: 80px; height: 80px; border-radius: 36px; display: flex; align-items: center; justify-content: center; margin-bottom: ${(props) => props.theme.spacing[2]}px; `; const StyledExchanger = styled.div` align-items: center; display: flex; margin-bottom: ${(props) => props.theme.spacing[5]}px; `; const StyledToken = styled.div` align-items: center; display: flex; flex-direction: column; font-weight: 600; `; const StyledCardActions = styled.div` display: flex; justify-content: center; margin-top: ${(props) => props.theme.spacing[3]}px; width: 50%; `; const StyledDesc = styled.span``; const StyledCardContentInner = styled.div` align-items: center; display: flex; flex: 1; flex-direction: column; justify-content: space-between; `; export default ExchangeCard;