Don't show "Show more/less" menu option in the sidebar if no more plugins are available

Summary: When all the plugins are selected, "Show more/less" menu option in the sidebar should not be shown

Reviewed By: passy

Differential Revision: D19164369

fbshipit-source-id: 50bec130e80c14aea2b4565e7659409d879e585c
This commit is contained in:
Kugan Vivekanandarajah
2020-01-07 04:06:55 -08:00
committed by Facebook Github Bot
parent bacb1958fc
commit 075b0905d3

View File

@@ -328,24 +328,26 @@ class MainSidebar extends PureComponent<Props, State> {
onFavorite, onFavorite,
)} )}
<ListItem> <ListItem>
<SidebarButton {favoritePlugins.length === allPlugins.length ? null : (
small <SidebarButton
compact small
onClick={() => compact
this.setState(state => ({ onClick={() =>
...state, this.setState(state => ({
showAllPlugins: !state.showAllPlugins, ...state,
})) showAllPlugins: !state.showAllPlugins,
}> }))
{showAllPlugins ? 'Show less' : 'Show more'} }>
<Glyph {showAllPlugins ? 'Show less' : 'Show more'}
size={8} <Glyph
name={showAllPlugins ? 'chevron-up' : 'chevron-down'} size={8}
style={{ name={showAllPlugins ? 'chevron-up' : 'chevron-down'}
marginLeft: 4, style={{
}} marginLeft: 4,
/> }}
</SidebarButton> />
</SidebarButton>
)}
</ListItem> </ListItem>
</> </>
)} )}