import * as React from 'react'; import styled, { css } from 'styled-components'; import { getCurrencyPreSymbol, formatPriceDisplay, formatAmount } from '../../utils/cashtab-helpers'; import CashtabBase from '../../hoc/CashtabBase'; import type { ButtonStates, CashtabBaseProps } from '../../hoc/CashtabBase'; import colors from '../../styles/colors'; import PriceDisplay from '../PriceDisplay'; import Button from '../../atoms/Button'; import ButtonQR from '../../atoms/ButtonQR'; import Small from '../../atoms/Small'; import Text from '../../atoms/Text'; import H3 from '../../atoms/H3'; const Outer = styled.div` display: grid; grid-template-columns: max-content; `; const Main = styled('div')<{ showBorder?: boolean }>` font-family: sans-serif; display: grid; grid-gap: 12px; padding: 12px 12px 6px; ${props => props.showBorder && css` border: 1px dashed ${colors.brand500}; border-radius: 4px; `} `; const Prices = styled.div` display: grid; /* grid-template-columns: max-content max-content; */ grid-gap: 5px; align-items: end; justify-content: end; `; const ButtonContainer = styled.div` min-height: 40px; display: grid; grid-gap: 7px; align-items: center; justify-content: flex-end; width: 100%; `; const BrandBottom = styled.div` display: flex; justify-content: flex-end; `; const A = styled.a` color: ${colors.fg500}; text-decoration: none; &:hover { color: ${colors.brand500}; } `; // Cashtab Badge Props type CashtabBadgeProps = CashtabBaseProps & { text?: string; tag?: string; step: ButtonStates; showAmount?: boolean; coinSymbol: string; coinName: string; coinAmount: number; coinDecimals?: number; showBrand?: boolean; showQR?: boolean; showBorder?: boolean; handleClick: Function; }; class CashtabBadge extends React.PureComponent { static defaultProps = { currency: 'USD', tag: 'CashTab Pay', text: 'Payment Total', showAmount: true, showBrand: false, showQR: true, showBorder: false }; render() { const { to, step, handleClick, currency, price, coinType, coinSymbol, coinName, coinDecimals, amount, text, tag, showAmount, showQR, showBorder, showBrand } = this.props; // Case 1: no bip70 invoice let displayedPriceInfo = ( {price !== undefined && ( )} {showAmount && ( )} ); return (

{text}

{displayedPriceInfo} {showQR ? ( {tag} ) : ( )} {(step === 'install' || showBrand) && ( What is Cashtab )}
); } } export type { CashtabBadgeProps }; export default CashtabBase(CashtabBadge);