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,
)}
<ListItem>
<SidebarButton
small
compact
onClick={() =>
this.setState(state => ({
...state,
showAllPlugins: !state.showAllPlugins,
}))
}>
{showAllPlugins ? 'Show less' : 'Show more'}
<Glyph
size={8}
name={showAllPlugins ? 'chevron-up' : 'chevron-down'}
style={{
marginLeft: 4,
}}
/>
</SidebarButton>
{favoritePlugins.length === allPlugins.length ? null : (
<SidebarButton
small
compact
onClick={() =>
this.setState(state => ({
...state,
showAllPlugins: !state.showAllPlugins,
}))
}>
{showAllPlugins ? 'Show less' : 'Show more'}
<Glyph
size={8}
name={showAllPlugins ? 'chevron-up' : 'chevron-down'}
style={{
marginLeft: 4,
}}
/>
</SidebarButton>
)}
</ListItem>
</>
)}