Skip to content

Commit

Permalink
Merge pull request #113 from county-of-simcoe-gis/hotfix-sidebar-cras…
Browse files Browse the repository at this point in the history
…h-mobile-view

fixed crash on slim sidebar toggle
  • Loading branch information
reed-tom authored Jun 22, 2021
2 parents b207693 + f141127 commit 7392d9f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "opengis",
"homepage": "https://opengis.simcoe.ca/public/",
"version": "1.0.10",
"version": "1.0.11",
"private": true,
"dependencies": {
"array-move": "^2.2.2",
Expand Down
27 changes: 9 additions & 18 deletions src/sidebar/Sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -348,21 +348,12 @@ class Sidebar extends Component {

togglePanelVisibility(callback = undefined) {
// PANEL IN AND OUT CLASSES
if (window.sidebarOpen) {
window.sidebarOpen = false;
this.setState({ sidebarOpen: false }, () => {
// EMIT A CHANGE IN THE SIDEBAR (IN OR OUT)
window.emitter.emit("sidebarChanged", window.sidebarOpen);
if (callback !== undefined) callback();
});
} else {
window.sidebarOpen = true;
this.setState({ sidebarOpen: true }, () => {
// EMIT A CHANGE IN THE SIDEBAR (IN OR OUT)
window.emitter.emit("sidebarChanged", window.sidebarOpen);
if (callback !== undefined) callback();
});
}
window.sidebarOpen = !window.sidebarOpen;
this.setState({ sidebarOpen: window.sidebarOpen }, () => {
// EMIT A CHANGE IN THE SIDEBAR (IN OR OUT)
window.emitter.emit("sidebarChanged", window.sidebarOpen);
if (callback !== undefined && typeof callback === "function") callback();
});
}

// TOOL AND THEME ITEMS CLICK
Expand All @@ -382,7 +373,7 @@ class Sidebar extends Component {
name={Component.props.name}
helpLink={Component.props.helpLink}
onClose={this.onPanelComponentClose}
onSidebarVisibility={this.togglePanelVisibility}
onSidebarVisibility={() => this.togglePanelVisibility()}
config={Component.props.config}
/>
);
Expand All @@ -408,7 +399,7 @@ class Sidebar extends Component {
name={Component.props.name}
helpLink={Component.props.helpLink}
onClose={this.onPanelComponentClose}
onSidebarVisibility={this.togglePanelVisibility}
onSidebarVisibility={() => this.togglePanelVisibility()}
config={Component.props.config}
/>
);
Expand Down Expand Up @@ -539,7 +530,7 @@ class Sidebar extends Component {
<div
id="sc-sidebar-advanced-tab"
className={this.state.tabClassName}
onClick={this.togglePanelVisibility}
onClick={() => this.togglePanelVisibility()}
>
<img src={require("./images/close-tab.png")} alt="Close Tab" />
</div>
Expand Down

0 comments on commit 7392d9f

Please sign in to comment.