mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-04 15:11:10 +08:00
Forbid resizing of SplitPane for mobile devices
This commit is contained in:
parent
a65ef029b6
commit
f7756fa81e
@ -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}
|
||||
|
Loading…
x
Reference in New Issue
Block a user