Skip to content

Commit 5762c15

Browse files
committed
Add ConsoleInput adjustment to font size
1 parent 95a096d commit 5762c15

File tree

4 files changed

+37
-19
lines changed

4 files changed

+37
-19
lines changed

client/modules/IDE/components/Console.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ const Console = ({ t }) => {
147147
<ConsoleInput
148148
theme={theme}
149149
dispatchConsoleEvent={dispatchConsoleEvent}
150+
fontSize={fontSize}
150151
/>
151152
}
152153
</div>

client/modules/IDE/components/ConsoleInput.jsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,14 @@ class ConsoleInput extends React.Component {
5555

5656
return null;
5757
});
58+
59+
this._cm.getWrapperElement().style['font-size'] = `${this.props.fontSize}px`;
5860
}
5961

6062
componentDidUpdate(prevProps) {
6163
this._cm.setOption('theme', `p5-${this.props.theme}`);
64+
this._cm.getWrapperElement().style['font-size'] = `${this.props.fontSize}px`;
65+
this._cm.refresh();
6266
}
6367

6468
componentWillUnmount() {
@@ -72,7 +76,14 @@ class ConsoleInput extends React.Component {
7276
<div
7377
className="console__input"
7478
>
75-
<RightArrowIcon className="console-active__arrow" focusable="false" aria-hidden="true" />
79+
<div className="console-active__arrow-container">
80+
<RightArrowIcon
81+
className="console-active__arrow"
82+
focusable="false"
83+
aria-hidden="true"
84+
style={{ width: `${this.props.fontSize}px` }}
85+
/>
86+
</div>
7687
<div ref={(element) => { this.codemirrorContainer = element; }} className="console__editor" />
7788
</div>
7889
);
@@ -81,7 +92,8 @@ class ConsoleInput extends React.Component {
8192

8293
ConsoleInput.propTypes = {
8394
theme: PropTypes.string.isRequired,
84-
dispatchConsoleEvent: PropTypes.func.isRequired
95+
dispatchConsoleEvent: PropTypes.func.isRequired,
96+
fontSize: PropTypes.number.isRequired
8597
};
8698

8799

client/styles/components/_console-input.scss

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,39 @@
11
.console__input {
2-
padding-left: #{20 / $base-font-size}rem;
3-
position: absolute;
4-
bottom: 0;
5-
height: #{22 / $base-font-size}rem;
62
width: 100%;
3+
display: flex;
4+
align-items: center;
75
@include themify() {
86
background-color: getThemifyVariable('console-input-background-color');
97
}
108
}
119

1210
.console__input .console-active__arrow {
13-
left: #{10 / $base-font-size}rem;
14-
position: absolute;
15-
top: #{4 / $base-font-size}rem;
16-
& svg {
17-
width: #{6 / $base-font-size}rem;
18-
height: #{10 / $base-font-size}rem;
19-
}
11+
width: auto;
12+
height: 55%;
2013
& g {
2114
@include themify() {
2215
fill: getThemifyVariable('console-active-arrow-color');
2316
}
2417
}
2518
}
2619

20+
.console-active__arrow-container {
21+
height: 100%;
22+
display: flex;
23+
align-items: center;
24+
justify-content: center;
25+
margin-left: #{10 / $base-font-size}rem;
26+
}
27+
2728
.console__editor {
28-
margin-left: #{8 / $base-font-size}rem;
29-
height: #{20 / $base-font-size}rem;
30-
line-height: #{20 / $base-font-size}rem;
29+
margin-left: #{15 / $base-font-size}rem;
30+
flex: 1;
31+
& .CodeMirror {
32+
height: auto;
33+
}
34+
& .CodeMirror-lines {
35+
padding-top: #{2 / $base-font-size}rem;
36+
}
3137
}
3238

3339
.console__editor .CodeMirror {

client/styles/components/_console.scss

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
width: 100%;
99
height: 100%;
1010
z-index: 1000;
11-
overflow: hidden;
1211
display: flex;
1312
flex-direction: column;
1413

@@ -41,9 +40,9 @@
4140

4241
.preview-console__messages {
4342
display: flex;
43+
flex: 1;
4444
flex-direction: column;
4545
overflow-y: scroll;
46-
margin-bottom: #{25 / $base-font-size}rem;
4746
}
4847

4948
.preview-console__collapse {
@@ -132,7 +131,7 @@
132131

133132
.preview-console__body {
134133
display: flex;
135-
flex-direction: column-reverse;
134+
flex-direction: column;
136135
height: calc(100% - #{30 / $base-font-size}rem);
137136

138137
.preview-console__message {

0 commit comments

Comments
 (0)