Skip to content

Commit 224894d

Browse files
flexing the sizes
1 parent f299ec2 commit 224894d

File tree

3 files changed

+29
-20
lines changed

3 files changed

+29
-20
lines changed

playground/internal/react/playground.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ func playgroundComponent() *Element {
4444
Div(Props{
4545
`id`: `code-output-box`,
4646
},
47-
CodeBox(code, setCode),
47+
Div(Props{
48+
`id`: `code-box-container`,
49+
},
50+
CodeBox(code, setCode),
51+
),
4852
OutputBox(output),
4953
),
5054
)

playground/playground.css

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212
--color-output-error-text: #800;
1313
--color-output-error-background: #fcc;
1414

15-
/* TODO(grantnelson-wf): Should update to more dynamic layout to allow wrapping and remove absolutes. */
16-
--height-banner: 50px; /* the amount of the page that the banner will take up */
17-
--height-output: 25%; /* the amount of the page that the output box will take up */
18-
1915
--font-family-banner-title: Arial, sans;
2016
--font-size-banner-title: 32px;
2117
--font-size-banner-title-sub: 24px;
@@ -68,6 +64,8 @@ html, body {
6864
/* The part of the banner containing the buttons and controls */
6965
#controls {
7066
display: flex;
67+
flex-wrap: wrap;
68+
flex-direction: row;
7169
justify-content: center;
7270
align-items: center;
7371
margin-left: auto;
@@ -146,35 +144,45 @@ html, body {
146144
display: flex;
147145
flex-direction: column;
148146
flex-grow: 1;
147+
box-sizing: border-box;
148+
overflow: none;
149149
}
150150

151-
/* The panel that contains the code text area and the lines numbers */
152-
#code-box {
151+
/* A panel containing the code-box used for resizable layout */
152+
#code-box-container {
153153
display: flex;
154-
flex-direction: row;
155-
flex-grow: 1;
156-
box-sizing: border-box;
157154
resize: vertical;
158155
overflow: auto;
159156
width: 100%;
160157
min-height: 50px;
161-
max-height: calc(100%-50px);
158+
max-height: 80%;
162159
height: 75%;
163160
flex-shrink: 0;
164-
align-items: stretch;
161+
}
165162

163+
/* The panel that contains the code text area and the lines numbers */
164+
#code-box {
165+
display: flex;
166+
flex-direction: row;
167+
flex-grow: 1;
168+
box-sizing: border-box;
169+
overflow: none;
170+
resize: none;
171+
width: 100%;
172+
align-items: stretch;
166173
border-top: 1px solid var(--color-code-box-borders);
167174
border-bottom: 1px solid var(--color-code-box-borders);
168175
}
169176

170177
/* The interactable text area for the code */
171178
#code {
172179
flex: 1;
173-
float: right;
174-
border: none;
175-
outline: none;
176180
resize: none;
181+
box-sizing: border-box;
182+
overflow-x: none;
183+
overflow-y: scroll;
177184
white-space: nowrap;
185+
outline: none;
178186
border: none;
179187
border-left: 1px solid var(--color-code-line-nums-border);
180188
padding: var(--padding-mono);
@@ -187,14 +195,13 @@ html, body {
187195

188196
/* The readonly line numbers next to the code */
189197
#line-nums {
190-
background: inherit;
191198
text-align: right;
192199
user-select: none;
193-
white-space: pre-line;
194200
overflow: hidden;
195201
text-overflow: clip;
196202
resize: none;
197203
max-width: 4ch;
204+
white-space: pre-line;
198205
border: none;
199206
outline: none;
200207
padding: var(--padding-mono);
@@ -209,10 +216,8 @@ html, body {
209216
width: 100%;
210217
min-height: 50px;
211218
flex-grow: 1;
212-
flex-shrink: 0;
213219
resize: none;
214220
box-sizing: border-box;
215-
216221
overflow: auto;
217222
padding: var(--padding-mono);
218223
background: var(--color-output-normal-background);

playground/playground.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)