zepio/app/components/wallet-summary.js

111 lines
2.5 KiB
JavaScript
Raw Normal View History

2018-12-10 09:07:45 -08:00
// @flow
import React from 'react';
import styled from 'styled-components';
import { TextComponent } from './text';
import { RowComponent } from './row';
2018-12-12 13:13:13 -08:00
import formatNumber from '../utils/formatNumber';
import theme from '../theme';
2018-12-10 09:07:45 -08:00
const Wrapper = styled.div`
2018-12-10 16:11:53 -08:00
display: flex;
flex-direction: column;
2018-12-10 09:07:45 -08:00
background-color: ${props => props.theme.colors.cardBackgroundColor};
border-radius: ${props => props.theme.boxBorderRadius};
2018-12-11 14:26:28 -08:00
padding: 37px 45px;
2019-01-08 06:33:39 -08:00
min-height: 250px;
position: relative;
2018-12-19 13:40:39 -08:00
margin-top: ${props => props.theme.layoutContentPaddingTop};
2018-12-10 09:07:45 -08:00
`;
const AllAddresses = styled(TextComponent)`
margin-bottom: 2.5px;
2018-12-21 04:13:01 -08:00
font-size: ${props => `${props.theme.fontSize.small}em`};
2018-12-10 09:07:45 -08:00
`;
const ValueBox = styled.div`
margin-bottom: 15px;
margin-right: 25px;
`;
const Label = styled(TextComponent)`
2018-12-11 14:26:28 -08:00
margin-top: 10px;
margin-bottom: 5px;
margin-left: -7.5px;
2018-12-10 09:07:45 -08:00
`;
const USDValue = styled(TextComponent)`
2018-12-11 14:26:28 -08:00
opacity: 0.5;
2018-12-21 04:13:01 -08:00
font-weight: ${props => props.theme.fontWeight.light};
2018-12-10 09:07:45 -08:00
`;
const ShieldedValue = styled(Label)`
color: ${props => props.theme.colors.activeItem};
`;
type Props = {
total: number,
shielded: number,
transparent: number,
zecPrice: number,
2018-12-10 09:07:45 -08:00
};
export const WalletSummaryComponent = ({
2018-12-15 07:10:39 -08:00
total,
shielded,
transparent,
zecPrice,
2018-12-10 09:07:45 -08:00
}: Props) => (
<Wrapper>
2019-01-24 06:56:49 -08:00
<AllAddresses
value='ALL ADDRESSES'
isBold
/>
2018-12-10 09:07:45 -08:00
<ValueBox>
2018-12-15 07:10:39 -08:00
<TextComponent
2018-12-21 04:13:01 -08:00
size={theme.fontSize.medium * 2.5}
2018-12-15 07:10:39 -08:00
value={`ZEC ${formatNumber({ value: total })}`}
isBold
/>
<USDValue
value={`USD $${formatNumber({ value: total * zecPrice })}`}
2018-12-21 04:13:01 -08:00
size={theme.fontSize.medium * 2}
2018-12-15 07:10:39 -08:00
/>
2018-12-10 09:07:45 -08:00
</ValueBox>
<RowComponent>
<ValueBox>
2018-12-15 07:10:39 -08:00
<ShieldedValue
value='&#9679; SHIELDED'
isBold
2018-12-21 04:13:01 -08:00
size={theme.fontSize.small}
2018-12-15 07:10:39 -08:00
/>
<TextComponent
value={`ZEC ${formatNumber({ value: shielded })}`}
isBold
2018-12-21 04:13:01 -08:00
size={theme.fontSize.medium}
2018-12-15 07:10:39 -08:00
/>
<USDValue
value={`USD $${formatNumber({ value: shielded * zecPrice })}`}
/>
2018-12-10 09:07:45 -08:00
</ValueBox>
<ValueBox>
2019-01-24 06:56:49 -08:00
<Label
value='&#9679; TRANSPARENT'
isBold
size={theme.fontSize.small}
/>
<TextComponent
value={`ZEC ${formatNumber({ value: transparent })}`}
isBold
2018-12-21 04:13:01 -08:00
size={theme.fontSize.medium}
/>
2018-12-15 07:10:39 -08:00
<USDValue
value={`USD $${formatNumber({ value: transparent * zecPrice })}`}
/>
2018-12-10 09:07:45 -08:00
</ValueBox>
</RowComponent>
</Wrapper>
);