From cfeb308e4e376e35d8fa509976a60a0135d7a256 Mon Sep 17 00:00:00 2001 From: meriadec Date: Mon, 4 Jun 2018 15:54:35 +0200 Subject: [PATCH] Put back the accounts empty state in MainSideBar --- src/components/MainSideBar.js | 1 + src/components/base/SideBar/SideBarList.js | 27 ++++++++++++++-------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/components/MainSideBar.js b/src/components/MainSideBar.js index 7a092b9c..61131246 100644 --- a/src/components/MainSideBar.js +++ b/src/components/MainSideBar.js @@ -145,6 +145,7 @@ class MainSideBar extends PureComponent { } items={accountsItems} + emptyText={t('emptyState:sidebar.text')} /> ) diff --git a/src/components/base/SideBar/SideBarList.js b/src/components/base/SideBar/SideBarList.js index ba1c5082..8dd1f00e 100644 --- a/src/components/base/SideBar/SideBarList.js +++ b/src/components/base/SideBar/SideBarList.js @@ -17,11 +17,12 @@ type Props = { activeValue?: string, scroll?: boolean, titleRight?: any, // TODO: type should be more precise, but, eh ¯\_(ツ)_/¯ + emptyText?: string, } class SideBarList extends PureComponent { render() { - const { items, title, activeValue, scroll, titleRight, ...props } = this.props + const { items, title, activeValue, scroll, titleRight, emptyText, ...props } = this.props const ListWrapper = scroll ? GrowScroll : Box return ( @@ -34,15 +35,21 @@ class SideBarList extends PureComponent { )} - - {items.map(item => { - const itemProps = { - item, - isActive: item.isActive || (!!activeValue && activeValue === item.value), - } - return - })} - + {items.length > 0 ? ( + + {items.map(item => { + const itemProps = { + item, + isActive: item.isActive || (!!activeValue && activeValue === item.value), + } + return + })} + + ) : emptyText ? ( + + {emptyText} + + ) : null} ) }