Skip to content

Commit 1eaa9ca

Browse files
committed
Revert "DevTools / Terminal UI fixes (codesandbox#2105)"
This reverts commit ab9026c.
1 parent ab9026c commit 1eaa9ca

File tree

7 files changed

+41
-30
lines changed

7 files changed

+41
-30
lines changed

.circleci/config.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@ version: 2.1
66

77
aliases:
88
- &restore_repo_cache
9-
key: v19-repo-{{ .Environment.CIRCLE_SHA1 }}
9+
key: v18-repo-{{ .Environment.CIRCLE_SHA1 }}
1010

1111
- &save_repo_cache
12-
key: v19-repo-{{ .Environment.CIRCLE_SHA1 }}
12+
key: v18-repo-{{ .Environment.CIRCLE_SHA1 }}
1313
paths:
1414
- ~/codesandbox-client
1515

1616
- &restore_deps_cache
1717
keys:
18-
- v19-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
19-
- v19-dependency-cache-{{ .Branch }}
20-
- v19-dependency-cache
18+
- v18-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
19+
- v18-dependency-cache-{{ .Branch }}
20+
- v18-dependency-cache
2121

2222
- &save_deps_cache
23-
key: v19-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
23+
key: v18-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
2424
paths:
2525
- node_modules
2626
- packages/app/node_modules
@@ -39,29 +39,29 @@ aliases:
3939

4040
- &restore_standalone_deps_cache
4141
keys:
42-
- v19-standalone-dependency-cache-{{ .Branch }}-{{ checksum "standalone-packages/codesandbox-browserfs/yarn.lock" }}
43-
- v19-standalone-dependency-cache-{{ .Branch }}
44-
- v19-standalone-dependency-cache
42+
- v18-standalone-dependency-cache-{{ .Branch }}-{{ checksum "standalone-packages/codesandbox-browserfs/yarn.lock" }}
43+
- v18-standalone-dependency-cache-{{ .Branch }}
44+
- v18-standalone-dependency-cache
4545

4646
- &save_standalone_deps_cache
47-
key: v19-standalone-dependency-cache-{{ .Branch }}-{{ checksum "standalone-packages/codesandbox-browserfs/yarn.lock" }}
47+
key: v18-standalone-dependency-cache-{{ .Branch }}-{{ checksum "standalone-packages/codesandbox-browserfs/yarn.lock" }}
4848
paths:
4949
- standalone-packages/codesandbox-browserfs/node_modules
5050

5151
- &restore_prod_build_cache
52-
key: v19-prod-app-build-cache-master
52+
key: v18-prod-app-build-cache-master
5353

5454
- &restore_prod_cache
55-
key: v19-prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
55+
key: v18-prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
5656

5757
- &save_prod_app_cache
58-
key: v19-prod-app-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
58+
key: v18-prod-app-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
5959
paths:
6060
- ./packages/app/www
6161
- ./packages/homepage/.cache
6262

6363
- &save_prod_cache
64-
key: v19-prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
64+
key: v18-prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
6565
paths:
6666
- ./www
6767

packages/app/src/app/components/Preview/DevTools/Terminal/Shell/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ class Shell extends React.PureComponent<Props> {
162162
}
163163

164164
render() {
165-
const { hidden } = this.props;
165+
const { height, hidden } = this.props;
166166

167167
return (
168168
<div
@@ -172,6 +172,7 @@ class Shell extends React.PureComponent<Props> {
172172
bottom: 0,
173173
left: 0,
174174
right: 0,
175+
height: height - 72,
175176
padding: '.5rem',
176177
visibility: hidden ? 'hidden' : 'visible',
177178
}}

packages/app/src/app/components/Preview/DevTools/Terminal/ShellTabs/elements.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ export const Container = styled.div`
66
background-color: ${props =>
77
props.theme['editorGroupHeader.tabsBackground'] || props.theme.background4};
88
9+
width: 100%;
910
align-items: center;
1011
font-size: 0.875rem;
1112
1213
color: ${props =>
1314
props.theme.light ? 'rgba(0, 0, 0, 0.5)' : 'rgba(255, 255, 255, 0.7)'};
14-
flex: none;
1515
`;
1616

1717
export const CrossIcon = styled(CrossIconClean)`

packages/app/src/app/components/Preview/DevTools/Terminal/index.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,7 @@ class TerminalComponent extends React.Component<Props, State> {
177177
const { height, hidden } = this.props;
178178

179179
return (
180-
<div
181-
className={hidden ? undefined : 'terminal'}
182-
ref={this.setupResizeObserver}
183-
>
180+
<div className={!hidden && 'terminal'} ref={this.setupResizeObserver}>
184181
{!hidden && this.state.shells.length > 0 && (
185182
<ShellTabs
186183
selectedShell={this.state.selectedShell}
@@ -190,14 +187,15 @@ class TerminalComponent extends React.Component<Props, State> {
190187
/>
191188
)}
192189

193-
<div style={{ position: 'relative', flex: 'auto' }}>
190+
<div style={{ position: 'relative' }}>
194191
<div
195192
style={{
196193
position: 'absolute',
197194
top: 0,
198195
bottom: 0,
199196
left: 0,
200197
right: 0,
198+
height: height - 72,
201199
padding: '1rem',
202200
visibility:
203201
hidden || this.state.selectedShell !== null

packages/app/src/app/components/Preview/DevTools/Terminal/styles.css

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@
160160
}
161161

162162
.terminal {
163-
flex: auto;
164-
display: flex;
165-
flex-direction: column;
163+
height: 100%;
164+
width: 100%;
166165
}

packages/app/src/app/components/Preview/DevTools/elements.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ export const Container = styled.div`
44
position: relative;
55
display: flex;
66
flex-direction: column;
7+
width: 100%;
8+
9+
max-height: 100%;
710
z-index: 7;
811
`;
912

@@ -38,6 +41,9 @@ export const ContentContainer = styled.div`
3841
props.theme['panel.background'] ||
3942
props.theme['editor.background'] ||
4043
props.theme.background4};
41-
flex: auto;
42-
display: flex;
44+
position: relative;
45+
overflow: auto;
46+
47+
width: 100%;
48+
height: 100%;
4349
`;

packages/app/src/app/components/Preview/DevTools/index.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -422,10 +422,17 @@ export default class DevTools extends React.PureComponent<Props, State> {
422422
this.normalizeHeight(el);
423423
}}
424424
style={{
425-
flex: primary
426-
? '1 1 0'
427-
: `0 0 ${height}${typeof height === 'number' ? 'px' : ''}`,
428-
minHeight: primary ? 0 : 'auto',
425+
height: primary ? '100%' : height,
426+
position: 'relative',
427+
display: 'flex',
428+
maxHeight: '100%',
429+
/**
430+
* Necessary to ensure it drags naturally. Otherwise there's an issue
431+
* where flex tries to allocate equal space to the preview and the terminal,
432+
* resulting in a very jaggy experience. We set flex-shrink to 0 only
433+
* for the console, and not for the preview
434+
*/
435+
flexShrink: devToolIndex === 1 ? 0 : 1,
429436
}}
430437
>
431438
{!hideTabs && (

0 commit comments

Comments
 (0)