Skip to content

Commit 9ddd980

Browse files
committed
Improve UX for demo
1 parent 692f133 commit 9ddd980

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

wasm/demo/src/index.html

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@
88
<h1>RustPython Demo</h1>
99
<p>
1010
RustPython is a Python interpreter writter in Rust. This demo is
11-
compiled from Rust to WebAssembly so it runs in the browser.
12-
</p>
13-
<p>
11+
compiled from Rust to WebAssembly so it runs in the browser. <br />
1412
Please input your python code below and click <kbd>Run</kbd>, or you
15-
can up your browser's devtools and play with
13+
can open up your browser's devtools and play with
1614
<code>rp.pyEval('print("a")')</code>
1715
</p>
1816
<textarea id="code">
@@ -27,7 +25,6 @@ <h1>RustPython Demo</h1>
2725
print(n1)
2826
n1, n2 = n2, n1 + n2
2927
count += 1
30-
3128
</textarea
3229
>
3330
<button id="run-btn">Run &#9655;</button>

wasm/demo/src/main.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ function runCodeFromTextarea() {
3333
const result = rp.pyEval(code, {
3434
stdout: '#console'
3535
});
36-
consoleElement.value += `\n${result}\n`;
36+
if (result !== null) {
37+
consoleElement.value += `\n${result}\n`;
38+
}
3739
} catch (e) {
3840
errorElement.textContent = e;
3941
console.error(e);

wasm/demo/src/style.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ textarea {
44
}
55

66
#code {
7-
height: 35vh;
7+
height: 30vh;
88
width: calc(100% - 3px);
99
}
1010

1111
.CodeMirror {
1212
border: 1px solid #ddd;
13-
height: 35vh !important;
13+
height: 30vh !important;
1414
}
1515

1616
#console {
17-
height: 35vh;
17+
height: 30vh;
1818
width: calc(100% - 3px);
1919
}
2020

0 commit comments

Comments
 (0)