Skip to content

Commit fb06836

Browse files
authored
Revert "Improve playground layout (#2098)" (#2117)
This reverts commit 1255ac0. Thee `html` element css update broke some things in VS Code. Reverting until I can figure it out and redo the change.
1 parent 778cf40 commit fb06836

File tree

6 files changed

+81
-148
lines changed

6 files changed

+81
-148
lines changed

npm/qsharp/ux/qsharp-ux.css

Lines changed: 24 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ modern-normalize (see https://mattbrictson.com/blog/css-normalize-and-reset for
6363

6464
html {
6565
box-sizing: border-box;
66-
overflow: hidden;
6766
font-size: 16px;
6867
}
6968

@@ -73,17 +72,17 @@ html {
7372

7473
.qs-play-body {
7574
position: relative;
76-
height: 100vh;
75+
min-height: 100vh;
7776
font-family: system-ui, "Segoe UI", "SegoeUI", Roboto, Helvetica, Arial,
7877
sans-serif;
7978
color: var(--main-color);
8079
background-color: var(--main-background);
8180
display: grid;
8281
grid-template-areas:
83-
"header header"
84-
"nav content";
82+
"header header header"
83+
"nav editor results";
8584
grid-template-rows: auto 1fr;
86-
grid-template-columns: minmax(180px, auto) 1fr;
85+
grid-template-columns: minmax(180px, auto) 8fr 8fr;
8786
column-gap: 16px;
8887
}
8988

@@ -100,12 +99,6 @@ html {
10099
padding-bottom: 8px;
101100
}
102101

103-
.content {
104-
grid-area: content;
105-
height: 100%;
106-
overflow: auto;
107-
}
108-
109102
#popup {
110103
position: absolute;
111104
display: none;
@@ -120,7 +113,6 @@ html {
120113

121114
.nav-column {
122115
grid-area: nav;
123-
overflow: auto;
124116
background-color: var(--nav-background);
125117
}
126118

@@ -151,60 +143,12 @@ html {
151143
background-color: var(--nav-current-background);
152144
}
153145

154-
/* Samples layout */
155-
156-
.samples {
157-
position: relative;
158-
height: 100%;
159-
display: grid;
160-
grid-template-areas:
161-
"editor-header results-labels"
162-
"editor-code output"
163-
"editor-commands ."
164-
"editor-diags .";
165-
grid-template-rows: 35px 1fr 35px 150px;
166-
grid-template-columns: 3fr 4fr;
167-
column-gap: 16px;
168-
padding-right: 16px;
169-
padding-top: 16px;
170-
}
171-
172-
.samples .code-editor {
173-
/* This position attribute allows the monaco editor
174-
to shrink when the window is resized to be smaller.
175-
https://stackoverflow.com/a/71876526 */
176-
position: absolute !important;
177-
grid-area: editor-code;
178-
height: 100%;
179-
width: 100%;
180-
}
181-
182-
.samples .button-row {
183-
grid-area: editor-commands;
184-
}
185-
186-
.samples .editor-header {
187-
grid-area: editor-header;
188-
}
189-
190-
.samples .diag-list {
191-
overflow: auto;
192-
grid-area: editor-diags;
193-
}
194-
195-
.samples .output {
196-
grid-area: output;
197-
height: 100%;
198-
min-height: 400px;
199-
resize: none;
200-
}
201-
202146
/* Editor section */
203147

204-
.editor-header {
205-
display: flex;
206-
justify-content: space-between;
207-
align-items: end;
148+
.editor-column {
149+
grid-area: editor;
150+
margin: 16px;
151+
margin-top: 32px;
208152
}
209153

210154
.file-name {
@@ -291,35 +235,29 @@ html {
291235
/* Katas */
292236

293237
.kata-override {
294-
/* The padding is just to shrink the width
295-
to make the content more readable */
296-
padding-right: 40%;
297-
background-color: var(--main-background);
298-
}
299-
300-
/* Documentation */
301-
302-
.doc-container {
303-
/* The padding is just to shrink the width
304-
to make the content more readable */
305-
padding-right: 40%;
306238
background-color: var(--main-background);
307239
}
308240

309241
/* TODO: Update all components with specific prefixes */
310242

311243
/* Results panels */
312244

245+
.results-column {
246+
grid-area: results;
247+
margin-left: 0px;
248+
margin-top: 32px;
249+
margin-right: 120px;
250+
}
251+
313252
.active-tab {
314253
font-size: 1.1rem;
315254
font-weight: 600;
316255
text-decoration: underline;
317256
}
318257

319258
.results-labels {
320-
grid-area: results-labels;
321259
display: flex;
322-
align-items: center;
260+
height: 32px;
323261
}
324262

325263
.results-labels > div {
@@ -330,14 +268,16 @@ html {
330268
}
331269

332270
.ast-output {
333-
height: 100%;
271+
height: 40vh;
272+
min-height: 400px;
334273
width: 100%;
335274
resize: none;
336275
white-space: pre;
337276
}
338277

339278
.hir-output {
340-
height: 100%;
279+
height: 40vh;
280+
min-height: 400px;
341281
width: 100%;
342282
resize: none;
343283
white-space: pre;
@@ -352,7 +292,8 @@ html {
352292
}
353293

354294
.qir-output {
355-
height: 100%;
295+
height: 40vh;
296+
min-height: 400px;
356297
width: 100%;
357298
resize: none;
358299
white-space: pre;
@@ -365,10 +306,11 @@ html {
365306
font-weight: 400;
366307
margin-top: 16px;
367308
margin-bottom: 16px;
309+
display: flex;
310+
justify-content: space-between;
368311
}
369312

370313
.prev-next {
371-
margin-bottom: 16px;
372314
font-weight: 200;
373315
cursor: pointer;
374316
}

playground/src/docs.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,5 @@ export function DocumentationDisplay(props: {
5353
}) {
5454
const docsMd = props.documentation?.get(props.currentNamespace) ?? "";
5555

56-
return (
57-
<div class="markdown-body doc-container">
58-
<Markdown markdown={docsMd} className="doc-container" />
59-
</div>
60-
);
56+
return <Markdown markdown={docsMd} />;
6157
}

playground/src/editor.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ export function Editor(props: {
250250
const newEditor = monaco.editor.create(editorDiv.current, {
251251
minimap: { enabled: false },
252252
lineNumbersMinChars: 3,
253-
automaticLayout: true,
254253
});
255254

256255
editor.current = newEditor;
@@ -414,8 +413,8 @@ export function Editor(props: {
414413
}
415414

416415
return (
417-
<>
418-
<div class="editor-header">
416+
<div class="editor-column">
417+
<div style="display: flex; justify-content: space-between; align-items: center;">
419418
<div class="file-name">main.qs</div>
420419
<div class="icon-row">
421420
<svg
@@ -521,6 +520,6 @@ export function Editor(props: {
521520
</div>
522521
))}
523522
</div>
524-
</>
523+
</div>
525524
);
526525
}

playground/src/main.tsx

Lines changed: 43 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -167,56 +167,54 @@ function App(props: { katas: Kata[]; linkedCode?: string }) {
167167
samples={sampleTitles}
168168
namespaces={getNamespaces(documentation)}
169169
></Nav>
170-
<div class="content">
171-
{sampleCode ? (
172-
<div class="samples">
173-
<Editor
174-
code={sampleCode}
175-
compiler={compiler}
176-
compiler_worker_factory={compiler_worker_factory}
177-
compilerState={compilerState}
178-
onRestartCompiler={onRestartCompiler}
179-
evtTarget={evtTarget}
180-
defaultShots={defaultShots}
181-
showShots={true}
182-
showExpr={true}
183-
shotError={shotError}
184-
profile={getProfile()}
185-
setAst={setAst}
186-
setHir={setHir}
187-
setRir={setRir}
188-
setQir={setQir}
189-
activeTab={activeTab}
190-
languageService={languageService}
191-
></Editor>
192-
<OutputTabs
193-
evtTarget={evtTarget}
194-
showPanel={true}
195-
onShotError={(diag?: VSDiagnostic) => setShotError(diag)}
196-
ast={ast}
197-
hir={hir}
198-
rir={rir}
199-
qir={qir}
200-
activeTab={activeTab}
201-
setActiveTab={setActiveTab}
202-
></OutputTabs>
203-
</div>
204-
) : activeKata ? (
205-
<Katas
206-
kata={activeKata!}
170+
{sampleCode ? (
171+
<>
172+
<Editor
173+
code={sampleCode}
207174
compiler={compiler}
208175
compiler_worker_factory={compiler_worker_factory}
209176
compilerState={compilerState}
210177
onRestartCompiler={onRestartCompiler}
178+
evtTarget={evtTarget}
179+
defaultShots={defaultShots}
180+
showShots={true}
181+
showExpr={true}
182+
shotError={shotError}
183+
profile={getProfile()}
184+
setAst={setAst}
185+
setHir={setHir}
186+
setRir={setRir}
187+
setQir={setQir}
188+
activeTab={activeTab}
211189
languageService={languageService}
212-
></Katas>
213-
) : (
214-
<DocumentationDisplay
215-
currentNamespace={currentNavItem}
216-
documentation={documentation}
217-
></DocumentationDisplay>
218-
)}
219-
</div>
190+
></Editor>
191+
<OutputTabs
192+
evtTarget={evtTarget}
193+
showPanel={true}
194+
onShotError={(diag?: VSDiagnostic) => setShotError(diag)}
195+
ast={ast}
196+
hir={hir}
197+
rir={rir}
198+
qir={qir}
199+
activeTab={activeTab}
200+
setActiveTab={setActiveTab}
201+
></OutputTabs>
202+
</>
203+
) : activeKata ? (
204+
<Katas
205+
kata={activeKata!}
206+
compiler={compiler}
207+
compiler_worker_factory={compiler_worker_factory}
208+
compilerState={compilerState}
209+
onRestartCompiler={onRestartCompiler}
210+
languageService={languageService}
211+
></Katas>
212+
) : (
213+
<DocumentationDisplay
214+
currentNamespace={currentNavItem}
215+
documentation={documentation}
216+
></DocumentationDisplay>
217+
)}
220218
<div id="popup"></div>
221219
</>
222220
);

playground/src/results.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,13 @@ export function ResultsTab(props: {
225225
{props.kataMode ? null : (
226226
<>
227227
<div class="output-header">
228+
<div>
229+
Shot {currIndex + 1} of {countForFilter}
230+
</div>
228231
<div class="prev-next">
229232
<span onClick={onPrev}>Prev</span> |{" "}
230233
<span onClick={onNext}>Next</span>
231234
</div>
232-
<div>
233-
Shot {currIndex + 1} of {countForFilter}
234-
</div>
235235
</div>
236236
<div class="result-label">Result: {resultLabel}</div>
237237
</>

playground/src/tabs.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export function OutputTabs(props: {
6565
setActiveTab: (tab: ActiveTab) => void;
6666
}) {
6767
return (
68-
<>
68+
<div class="results-column">
6969
{props.showPanel ? (
7070
<div class="results-labels">
7171
{tabArray.map((elem) => (
@@ -78,13 +78,11 @@ export function OutputTabs(props: {
7878
))}
7979
</div>
8080
) : null}
81-
<div class="output">
82-
<ResultsTab {...props} />
83-
<AstTab {...props} />
84-
<HirTab {...props} />
85-
<RirTab {...props} />
86-
<QirTab {...props} />
87-
</div>
88-
</>
81+
<ResultsTab {...props} />
82+
<AstTab {...props} />
83+
<HirTab {...props} />
84+
<RirTab {...props} />
85+
<QirTab {...props} />
86+
</div>
8987
);
9088
}

0 commit comments

Comments
 (0)