|
@ -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> |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|