From 5159b8368fb7e0bc1a6c6e01ca8e67a8d66804e1 Mon Sep 17 00:00:00 2001 From: meriadec Date: Thu, 8 Mar 2018 14:38:46 +0100 Subject: [PATCH] Add `Show more` to TransactionList --- src/components/DashboardPage/index.js | 1 + src/components/TransactionsList/index.js | 41 +++++++++++++++++++++- src/components/TransactionsList/stories.js | 5 ++- static/i18n/en/transactionsList.yml | 1 + 4 files changed, 46 insertions(+), 2 deletions(-) diff --git a/src/components/DashboardPage/index.js b/src/components/DashboardPage/index.js index 96018305..6b65dccb 100644 --- a/src/components/DashboardPage/index.js +++ b/src/components/DashboardPage/index.js @@ -190,6 +190,7 @@ class DashboardPage extends PureComponent { (p.size ? `${p.size}px` : '')}; ` +const ShowMore = styled(Box).attrs({ + horizontal: true, + flow: 1, + ff: 'Open Sans|SemiBold', + fontSize: 3, + justify: 'center', + align: 'center', + p: 4, + color: 'wallet', +})` + border-top: 1px solid ${p => p.theme.colors.fog}; + cursor: pointer; + &:hover { + text-decoration: underline; + } +` + const Transaction = ({ t, onAccountClick, @@ -175,6 +193,7 @@ type Props = { withAccounts?: boolean, minConfirmations: number, title?: string, + canShowMore: boolean, } class TransactionsList extends Component { @@ -182,9 +201,14 @@ class TransactionsList extends Component { onAccountClick: noop, withAccounts: false, minConfirmations: 2, + canShowMore: false, } shouldComponentUpdate(nextProps: Props) { + if (this.props.canShowMore !== nextProps.canShowMore) { + return true + } + if (this.props.minConfirmations !== nextProps.minConfirmations) { return true } @@ -201,7 +225,15 @@ class TransactionsList extends Component { _hashCache = null render() { - const { transactions, title, withAccounts, onAccountClick, minConfirmations, t } = this.props + const { + transactions, + title, + withAccounts, + onAccountClick, + minConfirmations, + canShowMore, + t, + } = this.props this._hashCache = this.getHashCache(transactions) @@ -232,6 +264,13 @@ class TransactionsList extends Component { /> ))} + + {canShowMore && ( + + {t('transactionsList:showMore')} + + + )} ) diff --git a/src/components/TransactionsList/stories.js b/src/components/TransactionsList/stories.js index 9ace0e99..8f67dc80 100644 --- a/src/components/TransactionsList/stories.js +++ b/src/components/TransactionsList/stories.js @@ -2,6 +2,7 @@ import React from 'react' import { storiesOf } from '@storybook/react' +import { boolean } from '@storybook/addon-knobs' import TransactionsList from 'components/TransactionsList' @@ -22,4 +23,6 @@ const transactions = [ }, ] -stories.add('basic', () => ) +stories.add('basic', () => ( + +)) diff --git a/static/i18n/en/transactionsList.yml b/static/i18n/en/transactionsList.yml index 0c000667..07ce6d37 100644 --- a/static/i18n/en/transactionsList.yml +++ b/static/i18n/en/transactionsList.yml @@ -4,3 +4,4 @@ address: Address amount: Amount from: From to: To +showMore: Show more