Skip to content

Commit

Permalink
Add conditional rendering for Control button
Browse files Browse the repository at this point in the history
  • Loading branch information
linusfj committed Mar 1, 2024
1 parent 9e355fc commit b34def3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion new-client/src/plugins/BaseWindowPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,14 @@ class BaseWindowPlugin extends React.PureComponent {
}

renderControlButton() {
// Special case: if there are no plugins with target "toolbar", we want to render the Control button on small screens
const hasToolbarTarget = this.props.app.config.mapConfig.tools.filter(
(tool) => tool.options && tool.options.target === "toolbar"
);

return createPortal(
// Hide Control button on small screens, see renderDrawerButton too
<Hidden mdDown>
<Hidden mdDown={hasToolbarTarget.length > 0}>
<PluginControlButton
icon={this.props.custom.icon}
onClick={this.handleButtonClick}
Expand Down

0 comments on commit b34def3

Please sign in to comment.