Skip to content

Commit

Permalink
Add proper css to fix scroll. (#317)
Browse files Browse the repository at this point in the history
Co-authored-by: Nikola Metulev <nmetulev@users.noreply.github.com>
  • Loading branch information
2 people authored and shweaver-MSFT committed Jun 9, 2020
1 parent e01901d commit 9da1a58
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
7 changes: 5 additions & 2 deletions packages/mgt/.storybook/addons/codeEditorAddon/codeAddon.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export const withCodeEditor = makeDecorator({

let storyHtml;
const root = document.createElement('div');
let storyElementWrapper = document.createElement('div');
let storyElement;

if (story.strings) {
Expand Down Expand Up @@ -98,14 +99,16 @@ export const withCodeEditor = makeDecorator({

const separator = document.createElement('div');

setupEditorResize(storyElement, separator, editor, () => editor.layout());
setupEditorResize(storyElementWrapper, separator, editor, () => editor.layout());

root.className = 'story-mgt-root';
storyElementWrapper.className = 'story-mgt-preview-wrapper';
storyElement.className = 'story-mgt-preview';
separator.className = 'story-mgt-separator';
editor.className = 'story-mgt-editor';

root.appendChild(storyElement);
root.appendChild(storyElementWrapper);
storyElementWrapper.appendChild(storyElement);
root.appendChild(separator);
root.appendChild(editor);

Expand Down
16 changes: 8 additions & 8 deletions packages/mgt/.storybook/preview-body.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@
}

.story-mgt-preview {
margin: 0.5em;
}

.story-mgt-preview-wrapper {
position: relative;
height: 100%;
width: calc(50% - 1em);
width: 50%;
float: left;
overflow: auto;
background-color: #ffffff;
}

.story-mgt-preview:first-child {
margin: 0.5em;
}

.story-mgt-editor {
width: 50%;
height: 100%;
Expand Down Expand Up @@ -61,8 +61,8 @@
}

@media (max-width: 768px) {
.story-mgt-preview {
height: calc(50% - 1em);
.story-mgt-preview-wrapper {
height: 50%;
width: 100%;
}

Expand All @@ -74,7 +74,7 @@
.story-mgt-separator {
cursor: ns-resize;
width: 100%;
height: 1px;
height: 0px;
}

.story-mgt-separator:after {
Expand Down

0 comments on commit 9da1a58

Please sign in to comment.