2018-12-13 09:21:18 -08:00
|
|
|
// @flow
|
2018-12-13 12:19:58 -08:00
|
|
|
import React from 'react';
|
2018-12-13 09:21:18 -08:00
|
|
|
import styled from 'styled-components';
|
|
|
|
import { TransactionItemComponent, type Transaction } from './transaction-item';
|
|
|
|
import { TextComponent } from './text';
|
|
|
|
|
|
|
|
const Wrapper = styled.div`
|
2018-12-13 12:19:58 -08:00
|
|
|
margin-top: 20px;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const TransactionsWrapper = styled.div`
|
2018-12-13 09:21:18 -08:00
|
|
|
border-radius: 7.5px;
|
|
|
|
overflow: hidden;
|
|
|
|
background-color: ${props => props.theme.colors.cardBackgroundColor};
|
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
|
|
|
box-sizing: border-box;
|
|
|
|
margin-bottom: 20px;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const Day = styled(TextComponent)`
|
|
|
|
text-transform: uppercase;
|
|
|
|
color: ${props => props.theme.colors.transactionsDate};
|
|
|
|
font-size: ${props => `${props.theme.fontSize.text * 0.9}em`};
|
|
|
|
font-weight: ${props => props.theme.fontWeight.bold};
|
|
|
|
margin-bottom: 5px;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const Divider = styled.div`
|
|
|
|
width: 100%;
|
|
|
|
height: 1px;
|
|
|
|
background-color: ${props => props.theme.colors.inactiveItem};
|
|
|
|
`;
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
transactionsDate: string,
|
|
|
|
transactions: Transaction[],
|
|
|
|
};
|
|
|
|
|
|
|
|
export const TransactionDailyComponent = ({ transactionsDate, transactions }: Props) => (
|
2018-12-13 12:19:58 -08:00
|
|
|
<Wrapper>
|
|
|
|
<Day value={transactionsDate} />
|
|
|
|
<TransactionsWrapper>
|
2018-12-13 09:21:18 -08:00
|
|
|
{transactions.map(({
|
|
|
|
date, type, address, amount,
|
2018-12-13 12:19:58 -08:00
|
|
|
}, idx) => (
|
2018-12-13 09:21:18 -08:00
|
|
|
<div>
|
2018-12-13 12:19:58 -08:00
|
|
|
<TransactionItemComponent type={type} date={date} address={address || ''} amount={amount} />
|
|
|
|
{idx < transactions.length - 1 && <Divider />}
|
2018-12-13 09:21:18 -08:00
|
|
|
</div>
|
|
|
|
))}
|
2018-12-13 12:19:58 -08:00
|
|
|
</TransactionsWrapper>
|
|
|
|
</Wrapper>
|
2018-12-13 09:21:18 -08:00
|
|
|
);
|