Skip to content

Commit f299ec2

Browse files
flexing the sizes
1 parent e689f5b commit f299ec2

File tree

5 files changed

+47
-26
lines changed

5 files changed

+47
-26
lines changed

playground/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
<script src="playground.js" defer></script>
1515
</head>
1616
<body>
17-
<div id="root"></div>
17+
<div id="playground"></div>
1818
</body>
1919
</html>

playground/internal/react/playground.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ func playgroundComponent() *Element {
2727
print("Share clicked") // TODO(grantnelson-wf): Implement
2828
}
2929

30-
return Div(Props{
31-
`id`: `playground`,
32-
},
30+
return Fragment(
3331
Div(Props{
3432
`id`: `banner`,
3533
},
@@ -43,7 +41,11 @@ func playgroundComponent() *Element {
4341
ShareUrlControl(shareUrl, onShareClick),
4442
),
4543
),
46-
CodeBox(code, setCode),
47-
OutputBox(output),
44+
Div(Props{
45+
`id`: `code-output-box`,
46+
},
47+
CodeBox(code, setCode),
48+
OutputBox(output),
49+
),
4850
)
4951
}

playground/playground.css

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,30 @@
2323
/* "mono" applies to mono-space text boxes, i.e. code, line number, and output */
2424
--font-family-mono: Menlo, Courier\ New, monospace;
2525
--font-size-mono: 11pt;
26-
--padding-mono: 5px;
26+
--padding-mono: 5px;
2727
--tab-size-code-text: 4;
2828
}
2929

30-
body {
30+
html, body {
3131
width: 100%;
3232
height: 100%;
3333
margin: 0;
3434
padding: 0;
35+
box-sizing: border-box;
36+
}
37+
38+
#playground {
39+
display: flex;
40+
flex-direction: column;
41+
width: 100%;
42+
height: 100%;
3543
}
3644

3745
#banner {
38-
position: absolute;
39-
top: 0;
40-
bottom: calc(100% - var(--height-banner));
41-
left: 0;
42-
right: 0;
4346
display: flex;
47+
flex-wrap: wrap;
4448
flex-direction: row;
49+
flex-shrink: 0;
4550
align-items: stretch;
4651
padding: 4px;
4752
background: var(--color-banner-background);
@@ -136,16 +141,28 @@ body {
136141
display: none;
137142
}
138143

144+
/* The panel that contains everything below the banner */
145+
#code-output-box{
146+
display: flex;
147+
flex-direction: column;
148+
flex-grow: 1;
149+
}
150+
139151
/* The panel that contains the code text area and the lines numbers */
140152
#code-box {
141153
display: flex;
142154
flex-direction: row;
155+
flex-grow: 1;
156+
box-sizing: border-box;
157+
resize: vertical;
158+
overflow: auto;
159+
width: 100%;
160+
min-height: 50px;
161+
max-height: calc(100%-50px);
162+
height: 75%;
163+
flex-shrink: 0;
143164
align-items: stretch;
144-
position: absolute;
145-
top: var(--height-banner);
146-
right: 0;
147-
bottom: var(--height-output);
148-
left: 0;
165+
149166
border-top: 1px solid var(--color-code-box-borders);
150167
border-bottom: 1px solid var(--color-code-box-borders);
151168
}
@@ -189,12 +206,14 @@ body {
189206

190207
/* The readonly box that contains all the output */
191208
#output-box {
192-
position: absolute;
209+
width: 100%;
210+
min-height: 50px;
211+
flex-grow: 1;
212+
flex-shrink: 0;
213+
resize: none;
214+
box-sizing: border-box;
215+
193216
overflow: auto;
194-
top: calc(100% - var(--height-output));
195-
right: 0;
196-
bottom: 0;
197-
left: 0;
198217
padding: var(--padding-mono);
199218
background: var(--color-output-normal-background);
200219
}

playground/playground.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
)
66

77
func main() {
8-
root := react.CreateRoot(`root`)
8+
root := react.CreateRoot(`playground`)
99
root.Render(react.StrictMode(
1010
react.Playground(),
1111
))

playground/playground.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)