Skip to content

Commit

Permalink
Forbid resizing of SplitPane for mobile devices
Browse files Browse the repository at this point in the history
  • Loading branch information
purrden committed Apr 17, 2018
1 parent a65ef02 commit f7756fa
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions lib/ui/src/modules/ui/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,22 +98,18 @@ const defaultSizes = {
},
};

const saveSizes = (sizes, isMobileDevice) => {
const storageItemName = isMobileDevice ? 'panelSizesMobile' : 'panelSizes';

const saveSizes = sizes => {
try {
localStorage.setItem(storageItemName, JSON.stringify(sizes));
localStorage.setItem('panelSizes', JSON.stringify(sizes));
return true;
} catch (e) {
return false;
}
};

const getSavedSizes = (sizes, isMobileDevice) => {
const storageItemName = isMobileDevice ? 'panelSizesMobile' : 'panelSizes';

const getSavedSizes = sizes => {
try {
const panelSizes = localStorage.getItem(storageItemName);
const panelSizes = localStorage.getItem('panelSizes');
if (panelSizes) {
return JSON.parse(panelSizes);
}
Expand Down Expand Up @@ -214,7 +210,7 @@ class Layout extends React.Component {
<div style={rootStyle}>
<SplitPane
split={storiesSplit}
allowResize={showStoriesPanel}
allowResize={isMobileDevice ? false : showStoriesPanel}
minSize={isMobileDevice ? 0 : 150}
maxSize={-400}
size={showStoriesPanel ? storiesPanelDefaultSize : 1}
Expand All @@ -230,7 +226,7 @@ class Layout extends React.Component {
</div>
<SplitPane
split={addonSplit}
allowResize={showAddonPanel}
allowResize={isMobileDevice ? false : showAddonPanel}
primary="second"
minSize={addonPanelInRight ? 200 : 100}
maxSize={-200}
Expand Down

0 comments on commit f7756fa

Please sign in to comment.