Skip to content

Commit 10061fd

Browse files
author
Ives van Hoorne
committed
Fix embedding sizes
1 parent 8a62589 commit 10061fd

File tree

2 files changed

+27
-19
lines changed

2 files changed

+27
-19
lines changed

src/embed/components/Content.js

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ const Container = styled.div`
1818

1919
const Split = styled.div`
2020
position: relative;
21-
width: ${props => props.show ? '100%' : '0px'};
21+
width: ${props => props.show ? '50%' : '0px'};
22+
max-width: ${props => props.only ? '100%' : '50%'};
23+
min-width: ${props => props.only ? '100%' : '50%'};
2224
height: ${props => props.editor ? 'calc(100% + 3rem)' : '100%'};
2325
`;
2426

@@ -66,8 +68,8 @@ export default class Content extends React.Component {
6668

6769
return (
6870
<Container>
69-
<Split editor show={showEditor}>
70-
{showEditor &&
71+
{showEditor &&
72+
<Split editor show={showEditor} only={showEditor && !showPreview}>
7173
<CodeEditor
7274
code={mainModule.code}
7375
error={null}
@@ -80,23 +82,24 @@ export default class Content extends React.Component {
8082
)}
8183
preferences={preferences}
8284
onlyViewMode
83-
/>}
84-
</Split>
85+
/>
86+
</Split>}
8587

86-
<Split show={showPreview}>
87-
<Preview
88-
sandboxId={sandbox.id}
89-
isInProjectView={false}
90-
modules={sandbox.modules}
91-
directories={sandbox.directories}
92-
bundle={this.state.bundle}
93-
externalResources={sandbox.externalResources}
94-
module={mainModule}
95-
fetchBundle={this.fetchBundle}
96-
setError={() => {}}
97-
preferences={preferences}
98-
/>
99-
</Split>
88+
{showPreview &&
89+
<Split show={showPreview} only={showPreview && !showEditor}>
90+
<Preview
91+
sandboxId={sandbox.id}
92+
isInProjectView={false}
93+
modules={sandbox.modules}
94+
directories={sandbox.directories}
95+
bundle={this.state.bundle}
96+
externalResources={sandbox.externalResources}
97+
module={mainModule}
98+
fetchBundle={this.fetchBundle}
99+
setError={() => {}}
100+
preferences={preferences}
101+
/>
102+
</Split>}
100103
</Container>
101104
);
102105
}

src/embed/components/Header.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ const MenuIcon = styled(MenuIconSVG)`
3030
const RightAligned = styled.div`
3131
position: absolute;
3232
right: 1rem;
33+
top: 0;
34+
bottom: 0;
35+
height: 100%;
36+
display: flex;
37+
justify-content: center;
3338
`;
3439

3540
type Props = {

0 commit comments

Comments
 (0)