Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:storybooks/storybook-ui
Browse files Browse the repository at this point in the history
# Conflicts:
#	dist/modules/api/index.js
#	dist/modules/ui/components/layout/index.js
#	dist/modules/ui/components/left_panel/header.js
#	packages/storybook-ui/src/modules/ui/components/shortcuts_help.js
#	yarn.lock
  • Loading branch information
ndelangen committed Apr 6, 2017
2 parents 7e0ced9 + e01f169 commit 92b706d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
25 changes: 24 additions & 1 deletion packages/storybook-ui/src/modules/ui/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,23 @@ const onDragEnd = function() {
document.body.classList.remove('dragging');
};

const saveHeightPanel = h => {
try {
localStorage.setItem('splitPos', h);
return true;
} catch (e) {
return false;
}
};

const getSavedHeight = h => {
try {
return localStorage.getItem('splitPos');
} catch (e) {
return h;
}
};

class Layout extends React.Component {
constructor(props) {
super(props);
Expand Down Expand Up @@ -129,6 +146,9 @@ class Layout extends React.Component {
downPanelDefaultSize = downPanelInRight ? 400 : 200;
}

// Get the value from localStorage or user downPanelDefaultSize
downPanelDefaultSize = getSavedHeight(downPanelDefaultSize);

return (
<div style={rootStyle}>
<SplitPane
Expand All @@ -152,7 +172,10 @@ class Layout extends React.Component {
resizerChildren={downPanelInRight ? vsplit : hsplit}
onDragStarted={onDragStart}
onDragFinished={onDragEnd}
onChange={this.onResize}
onChange={size => {
saveHeightPanel(size);
this.onResize();
}}
>
<div style={contentPanelStyle}>
<div
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,8 @@ escope@^3.6.0:
estraverse "^4.1.1"

eslint-config-airbnb-base@^11.1.2:
version "11.1.2"
resolved "https://registry.yarnpkg.com/eslint-config-airbnb-base/-/eslint-config-airbnb-base-11.1.2.tgz#259209a7678bf693e31cbe8f953f206b6aa7ccc3"
version "11.1.3"
resolved "https://registry.yarnpkg.com/eslint-config-airbnb-base/-/eslint-config-airbnb-base-11.1.3.tgz#0e8db71514fa36b977fbcf977c01edcf863e0cf0"

eslint-import-resolver-node@^0.2.0:
version "0.2.3"
Expand Down Expand Up @@ -844,8 +844,8 @@ js-tokens@^3.0.0:
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7"

js-yaml@^3.5.1:
version "3.8.2"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.8.2.tgz#02d3e2c0f6beab20248d412c352203827d786721"
version "3.8.3"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.8.3.tgz#33a05ec481c850c8875929166fe1beb61c728766"
dependencies:
argparse "^1.0.7"
esprima "^3.1.1"
Expand Down

0 comments on commit 92b706d

Please sign in to comment.