Skip to content

Commit ab9026c

Browse files
lbogdanCompuIves
authored andcommitted
DevTools / Terminal UI fixes (codesandbox#2105)
* DevTools / Terminal UI fixes. * Bump CircleCI cache keys version. * CSS fixes.
1 parent 7242c0e commit ab9026c

File tree

7 files changed

+30
-41
lines changed

7 files changed

+30
-41
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: v18-repo-{{ .Environment.CIRCLE_SHA1 }}
9+
key: v19-repo-{{ .Environment.CIRCLE_SHA1 }}
1010

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

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

2222
- &save_deps_cache
23-
key: v18-dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
23+
key: v19-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-
- v18-standalone-dependency-cache-{{ .Branch }}-{{ checksum "standalone-packages/codesandbox-browserfs/yarn.lock" }}
43-
- v18-standalone-dependency-cache-{{ .Branch }}
44-
- v18-standalone-dependency-cache
42+
- v19-standalone-dependency-cache-{{ .Branch }}-{{ checksum "standalone-packages/codesandbox-browserfs/yarn.lock" }}
43+
- v19-standalone-dependency-cache-{{ .Branch }}
44+
- v19-standalone-dependency-cache
4545

4646
- &save_standalone_deps_cache
47-
key: v18-standalone-dependency-cache-{{ .Branch }}-{{ checksum "standalone-packages/codesandbox-browserfs/yarn.lock" }}
47+
key: v19-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: v18-prod-app-build-cache-master
52+
key: v19-prod-app-build-cache-master
5353

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

5757
- &save_prod_app_cache
58-
key: v18-prod-app-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
58+
key: v19-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: v18-prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
64+
key: v19-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: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ class Shell extends React.PureComponent<Props> {
162162
}
163163

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

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

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%;
109
align-items: center;
1110
font-size: 0.875rem;
1211
1312
color: ${props =>
1413
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: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,10 @@ class TerminalComponent extends React.Component<Props, State> {
177177
const { height, hidden } = this.props;
178178

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

190-
<div style={{ position: 'relative' }}>
193+
<div style={{ position: 'relative', flex: 'auto' }}>
191194
<div
192195
style={{
193196
position: 'absolute',
194197
top: 0,
195198
bottom: 0,
196199
left: 0,
197200
right: 0,
198-
height: height - 72,
199201
padding: '1rem',
200202
visibility:
201203
hidden || this.state.selectedShell !== null

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

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

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

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

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

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

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

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -422,17 +422,10 @@ export default class DevTools extends React.PureComponent<Props, State> {
422422
this.normalizeHeight(el);
423423
}}
424424
style={{
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,
425+
flex: primary
426+
? '1 1 0'
427+
: `0 0 ${height}${typeof height === 'number' ? 'px' : ''}`,
428+
minHeight: primary ? 0 : 'auto',
436429
}}
437430
>
438431
{!hideTabs && (

0 commit comments

Comments
 (0)