Forbid resizing of SplitPane for mobile devices

This commit is contained in:
denzenin 2018-04-17 20:14:47 +03:00
parent a65ef029b6
commit f7756fa81e

View File

@ -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);
}
@ -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}
@ -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}