2018-12-13 09:21:18 -08:00
|
|
|
// @flow
|
2019-02-04 20:41:45 -08:00
|
|
|
|
2018-12-21 07:43:12 -08:00
|
|
|
import React, { Fragment } from 'react';
|
2018-12-13 09:21:18 -08:00
|
|
|
import styled from 'styled-components';
|
2018-12-20 06:09:10 -08:00
|
|
|
|
2018-12-13 09:21:18 -08:00
|
|
|
import { TransactionItemComponent, type Transaction } from './transaction-item';
|
|
|
|
import { TextComponent } from './text';
|
2018-12-20 06:09:10 -08:00
|
|
|
import { Divider } from './divider';
|
|
|
|
|
2018-12-13 09:21:18 -08:00
|
|
|
const Wrapper = styled.div`
|
2018-12-13 12:19:58 -08:00
|
|
|
margin-top: 20px;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const TransactionsWrapper = styled.div`
|
2019-02-07 08:31:59 -08:00
|
|
|
border-radius: ${props => props.theme.boxBorderRadius};
|
2018-12-13 09:21:18 -08:00
|
|
|
overflow: hidden;
|
2019-02-07 08:31:59 -08:00
|
|
|
background-color: ${props => props.theme.colors.cardBackgroundColor};
|
2018-12-13 09:21:18 -08:00
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
|
|
|
box-sizing: border-box;
|
|
|
|
margin-bottom: 20px;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const Day = styled(TextComponent)`
|
|
|
|
text-transform: uppercase;
|
2019-02-07 08:31:59 -08:00
|
|
|
color: ${props => props.theme.colors.transactionsDate};
|
|
|
|
font-size: ${props => `${props.theme.fontSize.regular * 0.9}em`};
|
|
|
|
font-weight: ${props => String(props.theme.fontWeight.bold)};
|
2018-12-13 09:21:18 -08:00
|
|
|
margin-bottom: 5px;
|
|
|
|
`;
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
transactionsDate: string,
|
|
|
|
transactions: Transaction[],
|
2018-12-13 13:37:15 -08:00
|
|
|
zecPrice: number,
|
2018-12-13 09:21:18 -08:00
|
|
|
};
|
|
|
|
|
2019-02-06 19:06:48 -08:00
|
|
|
export const TransactionDailyComponent = ({ transactionsDate, transactions, zecPrice }: Props) => (
|
2019-01-31 08:38:42 -08:00
|
|
|
<Wrapper data-testid='TransactionsDaily'>
|
2018-12-13 12:19:58 -08:00
|
|
|
<Day value={transactionsDate} />
|
|
|
|
<TransactionsWrapper>
|
2019-02-06 19:06:48 -08:00
|
|
|
{transactions.map(({
|
|
|
|
date, type, address, amount, transactionId,
|
|
|
|
}, idx) => (
|
|
|
|
<Fragment key={`${address}-${type}-${amount}-${date}`}>
|
|
|
|
<TransactionItemComponent
|
|
|
|
transactionId={transactionId}
|
|
|
|
type={type}
|
|
|
|
date={date}
|
|
|
|
address={address || ''}
|
|
|
|
amount={amount}
|
|
|
|
zecPrice={zecPrice}
|
|
|
|
/>
|
|
|
|
{idx < transactions.length - 1 && <Divider />}
|
|
|
|
</Fragment>
|
|
|
|
))}
|
2018-12-13 12:19:58 -08:00
|
|
|
</TransactionsWrapper>
|
|
|
|
</Wrapper>
|
2018-12-13 09:21:18 -08:00
|
|
|
);
|