Browse Source

Put back the accounts empty state in MainSideBar

master
meriadec 7 years ago
parent
commit
cfeb308e4e
No known key found for this signature in database GPG Key ID: 1D2FC2305E2CB399
  1. 1
      src/components/MainSideBar.js
  2. 9
      src/components/base/SideBar/SideBarList.js

1
src/components/MainSideBar.js

@ -145,6 +145,7 @@ class MainSideBar extends PureComponent<Props> {
</PlusWrapper> </PlusWrapper>
} }
items={accountsItems} items={accountsItems}
emptyText={t('emptyState:sidebar.text')}
/> />
</Box> </Box>
) )

9
src/components/base/SideBar/SideBarList.js

@ -17,11 +17,12 @@ type Props = {
activeValue?: string, activeValue?: string,
scroll?: boolean, scroll?: boolean,
titleRight?: any, // TODO: type should be more precise, but, eh ¯\_(ツ)_/¯ titleRight?: any, // TODO: type should be more precise, but, eh ¯\_(ツ)_/¯
emptyText?: string,
} }
class SideBarList extends PureComponent<Props> { class SideBarList extends PureComponent<Props> {
render() { 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 const ListWrapper = scroll ? GrowScroll : Box
return ( return (
<Fragment> <Fragment>
@ -34,6 +35,7 @@ class SideBarList extends PureComponent<Props> {
<Space of={20} /> <Space of={20} />
</Fragment> </Fragment>
)} )}
{items.length > 0 ? (
<ListWrapper flow={2} px={3} fontSize={3} {...props}> <ListWrapper flow={2} px={3} fontSize={3} {...props}>
{items.map(item => { {items.map(item => {
const itemProps = { const itemProps = {
@ -43,6 +45,11 @@ class SideBarList extends PureComponent<Props> {
return <SideBarListItem key={item.value} {...itemProps} /> return <SideBarListItem key={item.value} {...itemProps} />
})} })}
</ListWrapper> </ListWrapper>
) : emptyText ? (
<Box px={4} ff="Open Sans|Regular" fontSize={3} color="grey">
{emptyText}
</Box>
) : null}
</Fragment> </Fragment>
) )
} }

Loading…
Cancel
Save