Skip to content

Commit 17c1f38

Browse files
gregorybchristekknolagi
authored andcommitted
Update styles of repl UI (#31)
1 parent d409f13 commit 17c1f38

2 files changed

Lines changed: 40 additions & 108 deletions

File tree

repl.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,19 @@
3131
</div>
3232
<div>
3333
<!-- TODO(max): Add button to save to/load from disk. -->
34-
<button id="clear-local-storage">Clear LocalStorage</button>
34+
<button id="clear-local-storage">Clear</button>
3535
</div>
3636
<div id="output" style="height: 400px; overflow: auto;">
3737
Output:
3838
</div>
3939
<div>
40-
<code>>>> </code><input id="input" type="text" />
40+
<code><span id="prompt-string">>>></span></code><input id="input" type="text" />
4141
</div>
4242
<script type="module">
4343
"use strict";
4444

4545
function updateHistory(inp, out) {
46+
const wrap = document.createElement("div");
4647
const pre_inp = document.createElement("pre");
4748
pre_inp.setAttribute("class", "language-text");
4849
const code_inp = document.createElement("code");
@@ -57,8 +58,9 @@
5758
code_out.append(`${out}`);
5859
pre_out.append(code_out);
5960

60-
output.append(pre_inp);
61-
output.append(pre_out);
61+
wrap.append(pre_inp);
62+
wrap.append(pre_out);
63+
output.append(wrap);
6264
output.scrollTop = output.scrollHeight;
6365
}
6466

style.css

Lines changed: 34 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,14 @@ a:hover {
125125
opacity: 0.8;
126126
}
127127

128+
#output {
129+
display: flex;
130+
flex-direction: column;
131+
gap: 0.5em;
132+
margin: 0.8em 0;
133+
box-sizing: border-box;
134+
}
135+
128136
pre {
129137
overflow-x: scroll;
130138
}
@@ -137,7 +145,6 @@ pre[class*="language-"] {
137145
font-size: 0.8rem;
138146
}
139147
pre[class*="language-"] {
140-
border-radius: 5px;
141148
padding: 0.5em 0.5em;
142149
margin: 0em;
143150
z-index: 2;
@@ -156,11 +163,13 @@ pre > code {
156163

157164
:not(pre) > code[class*="language-"], pre[class*="language-"] {
158165
background: #2d2d2d;
166+
border-radius: 5px 5px 0px 0px;
159167
}
160168
pre[class*="language-"] + pre[class*="language-"].result {
161169
background-color: #202020;
162170
position: relative;
163171
opacity: 0.9;
172+
border-radius: 0px 0px 5px 5px;
164173
}
165174

166175
pre[class*="language-"].result {
@@ -172,113 +181,34 @@ input[type="text"], textarea {
172181
color: #ccc;
173182
}
174183

175-
/*
176-
main {
177-
margin: 2rem;
178-
max-width: 650px;
179-
}
180-
img {
181-
max-width: 600px;
182-
width: 95vw;
183-
}
184-
ul {
185-
list-style-type: circle;
186-
padding-left: 20px;
187-
}
188-
189-
p, dl, ol, ul {
190-
line-height: 1.8rem;
191-
max-width: 50ch;
192-
color: #CCC;
193-
}
194-
195-
html {
196-
background-color: #151515;
197-
color: #eee;
198-
}
199-
a:link {
200-
text-decoration: none;
201-
text-decoration-thickness: 1px;
202-
text-underline-offset: 0.15rem;
203-
text-decoration-style: dotted;
204-
}
205-
a {
206-
color: #A0D2A2;
207-
}
208-
a:visited {
209-
}
210-
a:active {
211-
}
212-
213-
h1 {
214-
font-weight: 900;
215-
font-size: 3rem;
216-
letter-spacing: 0.1rem;
217-
text-transform: uppercase;
218-
}
219-
h1 a, h1 a:visited, h1 a:active {
220-
color: white;
221-
}
222-
h2 {
223-
font-size: 1.8rem;
224-
margin-top: 4.5rem;
225-
padding-top: 2rem;
226-
border-top: 1px solid #666;
227-
}
228-
h3 {
229-
font-size: 1.4rem;
230-
margin-top: 3rem;
231-
font-weight: 600;
184+
#prompt-string {
185+
font-family: "Nunito Sans", sans-serif;
186+
font-weight: bold;
187+
display: inline-block;
188+
padding-right: 0.4em;
232189
}
233190

234-
@media (min-width: 760px) {
235-
main {
236-
margin: 3rem auto;
237-
}
238-
h1, h2 {
239-
margin-left: -1rem;
240-
}
191+
#input {
192+
font-family: "Fira Code", Monaco, Menlo, Consolas, "Courier New", monospace;
193+
background-color: #2d2d2d;
194+
color: #d4d4d4;
195+
border: none;
196+
padding: 0.5em 0.8em;
197+
border-radius: 5px;
198+
transition: background-color 200ms;
241199
}
242200

243-
h1 {
244-
display: flex;
245-
flex-wrap: wrap;
246-
gap: 1rem;
247-
align-items: center;
248-
justify-items: left;
249-
justify-content: left;
250-
line-height: 1.5;
251-
}
252-
h1 a {
253-
line-height: 0;
254-
}
255-
h1 img {
256-
width: 2.5rem;
257-
height: 2.5rem;
258-
-webkit-filter: invert(1);
259-
filter: invert(1);
260-
}
261-
#coming {
262-
font-weight: 500;
263-
font-size: 0.5rem;
264-
padding: 0.5rem;
265-
border: 1px solid white;
201+
#clear-local-storage {
202+
font-family: "Nunito Sans", sans-serif;
203+
background-color: #2d2d2d;
204+
color: #d4d4d4;
205+
border: none;
206+
padding: 0.5em 1.2em;
207+
font-weight: bold;
266208
border-radius: 5px;
267-
display: inline-block;
268-
order: 1;
269-
}
270-
@media (max-width: 505px) {
271-
#title {
272-
display: none;
273-
}
209+
transition: background-color 200ms;
274210
}
275-
@media (max-width: 760px) {
276-
h1 {
277-
font-size: 2rem;
278-
}
279-
}
280-
281-
#table-of-contents, h2, h3 {
282-
text-transform: capitalize;
211+
#clear-local-storage:hover {
212+
cursor: pointer;
213+
background-color: #434343;
283214
}
284-
*/

0 commit comments

Comments
 (0)