8000 Merge pull request #62 from pyscript/centre-repl-play-icon · Srivari07/pyscript@2df4400 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2df4400

Browse files
authored
Merge pull request pyscript#62 from pyscript/centre-repl-play-icon
Play icon in pyrepl vertically centered w.r.to the last line
2 parents 3be4e26 + 4259e08 commit 2df4400

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

pyscriptjs/src/components/pyrepl.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class PyRepl extends BaseEvalElement {
5050

5151
// add an extra div where we can attach the codemirror editor
5252
this.editorNode = document.createElement('div');
53-
addClasses(this.editorNode, ["editor-box", "border", "border-gray-300"]);
53+
addClasses(this.editorNode, ["editor-box", "border", "border-gray-300", "group", "relative"]);
5454
this.shadow.appendChild(this.wrapper);
5555
}
5656

@@ -95,22 +95,16 @@ export class PyRepl extends BaseEvalElement {
9595
});
9696

9797
const mainDiv = document.createElement('div');
98-
addClasses(mainDiv, ["parentBox", "group", "flex", "flex-col", "mt-2", "mx-8", "relative"])
98+
addClasses(mainDiv, ["parentBox", "flex", "flex-col", "mt-2", "mx-8", "relative"])
9999

100100
// add Editor to main PyScript div
101101
mainDiv.appendChild(this.editorNode);
102102

103-
// Butons DIV
104-
const eDiv = document.createElement('div');
105-
addClasses(eDiv, "buttons-box opacity-0 group-hover:opacity-100 relative right-0 -top-4 z-10 flex flex-row-reverse space-x-reverse space-x-4 font-mono text-white text-sm font-bold leading-6 dev-buttons-group".split(" "))
106-
eDiv.setAttribute("role", "group");
107-
108103
// Play Button
109104
this.btnRun = document.createElement('button');
110105
this.btnRun.innerHTML = '<svg id="" class="svelte-fa svelte-ps5qeg" style="height:20px;width:20px;vertical-align:-.125em;transform-origin:center;overflow:visible;color:green" viewBox="0 0 384 512" aria-hidden="true" role="img" xmlns="http://www.w3.org/2000/svg"><g transform="translate(192 256)" transform-origin="96 0"><g transform="translate(0,0) scale(1,1)"><path d="M361 215C375.3 223.8 384 239.3 384 256C384 272.7 375.3 288.2 361 296.1L73.03 472.1C58.21 482 39.66 482.4 24.52 473.9C9.377 465.4 0 449.4 0 432V80C0 62.64 9.377 46.63 24.52 38.13C39.66 29.64 58.21 29.99 73.03 39.04L361 215z" fill="currentColor" transform="translate(-192 -256)"></path></g></g></svg>';
111-
const buttonClasses = ["mr-2", "block"];
112-
addClasses(this.btnRun, buttonClasses);
113-
eDiv.appendChild(this.btnRun);
106+
addClasses(this.btnRun, ["absolute", "right-1", "bottom-3", "opacity-0", "group-hover:opacity-100"]);
107+
this.editorNode.appendChild(this.btnRun);
114108

115109
this.btnRun.onclick = wrap(this);
116110

@@ -121,8 +115,6 @@ export class PyRepl extends BaseEvalElement {
121115
return evaluatePython;
122116
}
123117

124-
mainDiv.appendChild(eDiv);
125-
126118
if (!this.id) {
127119
console.log(
128120
'WARNING: <pyrepl> define with an id. <pyrepl> should always have an id. More than one <pyrepl> on a page won\'t work otherwise!',

0 commit comments

Comments
 (0)
0