Skip to content

Commit 8aff206

Browse files
committed
Fix some dialog styling issues
- Fix black text caused by 1.32.0 upgrade. - Fix various alignment and padding issues (a few elements with more space below than above).
1 parent 03c0bde commit 8aff206

File tree

4 files changed

+18
-20
lines changed

4 files changed

+18
-20
lines changed

packages/ide/src/fill/dialog.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
background: #141414;
2020
border: none;
2121
box-sizing: border-box;
22-
margin-bottom: 25px;
2322
padding: 10px;
2423
width: 100%;
2524
}
@@ -31,11 +30,11 @@
3130

3231
.msgbox > .detail {
3332
font-size: 14px;
34-
margin-top: 5px;
33+
margin: 5px 0;
3534
}
3635

3736
.msgbox > .errors {
38-
margin-bottom: 25px;
37+
margin-top: 20px;
3938
}
4039

4140
.msgbox > .errors {
@@ -46,6 +45,7 @@
4645
display: flex;
4746
flex-direction: row;
4847
justify-content: space-between;
48+
margin-top: 20px;
4949
}
5050

5151
.msgbox > .button-wrapper > button {

packages/ide/src/fill/dialog.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,31 @@ export class Dialog {
3131
private input: HTMLInputElement | undefined;
3232
private errors: HTMLElement;
3333
private buttons: HTMLElement[] | undefined;
34+
private readonly msgBox: HTMLElement;
3435

3536
private actionEmitter = new Emitter<IDialogAction>();
3637
public onAction = this.actionEmitter.event;
3738

3839
public constructor(private readonly options: IDialogOptions) {
39-
const msgBox = document.createElement("div");
40-
msgBox.classList.add("msgbox");
40+
this.msgBox = document.createElement("div");
41+
this.msgBox.classList.add("msgbox");
4142

4243
if (this.options.message) {
4344
const messageDiv = document.createElement("div");
4445
messageDiv.classList.add("msg");
4546
messageDiv.innerText = this.options.message;
46-
msgBox.appendChild(messageDiv);
47+
this.msgBox.appendChild(messageDiv);
4748
}
4849

4950
if (this.options.detail) {
5051
const detailDiv = document.createElement("div");
5152
detailDiv.classList.add("detail");
5253
detailDiv.innerText = this.options.detail;
53-
msgBox.appendChild(detailDiv);
54+
this.msgBox.appendChild(detailDiv);
5455
}
5556

5657
if (this.options.input) {
57-
msgBox.classList.add("input");
58+
this.msgBox.classList.add("input");
5859
this.input = document.createElement("input");
5960
this.input.classList.add("input");
6061
this.input.value = this.options.input.value;
@@ -67,12 +68,11 @@ export class Dialog {
6768
});
6869
}
6970
});
70-
msgBox.appendChild(this.input);
71+
this.msgBox.appendChild(this.input);
7172
}
7273

7374
this.errors = document.createElement("div");
7475
this.errors.classList.add("errors");
75-
msgBox.appendChild(this.errors);
7676

7777
if (this.options.buttons && this.options.buttons.length > 0) {
7878
this.buttons = this.options.buttons.map((buttonText, buttonIndex) => {
@@ -92,12 +92,12 @@ export class Dialog {
9292
const buttonWrapper = document.createElement("div");
9393
buttonWrapper.classList.add("button-wrapper");
9494
this.buttons.forEach((b) => buttonWrapper.appendChild(b));
95-
msgBox.appendChild(buttonWrapper);
95+
this.msgBox.appendChild(buttonWrapper);
9696
}
9797

9898
this.overlay = document.createElement("div");
9999
this.overlay.className = "msgbox-overlay";
100-
this.overlay.appendChild(msgBox);
100+
this.overlay.appendChild(this.msgBox);
101101

102102
setTimeout(() => {
103103
this.overlay.style.opacity = "1";
@@ -122,6 +122,7 @@ export class Dialog {
122122
const errorDiv = document.createElement("error");
123123
errorDiv.innerText = error;
124124
this.errors.appendChild(errorDiv);
125+
this.msgBox.appendChild(this.errors);
125126
}
126127
}
127128

@@ -131,7 +132,7 @@ export class Dialog {
131132
public show(): void {
132133
if (!this.cachedActiveElement) {
133134
this.cachedActiveElement = document.activeElement as HTMLElement;
134-
document.body.appendChild(this.overlay);
135+
(document.getElementById("workbench.main.container") || document.body).appendChild(this.overlay);
135136
document.addEventListener("keydown", this.onKeydown);
136137
if (this.input) {
137138
this.input.focus();

packages/vscode/src/dialog.scss

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,14 @@
2828
font-weight: normal;
2929
text-transform: uppercase;
3030
white-space: nowrap;
31-
padding-left: 10px;
31+
padding: 5px 10px;
3232
}
3333

3434
.nav {
3535
display: flex;
3636
flex-direction: row;
3737
padding: 4px;
38-
padding-top: 8px;
39-
padding-bottom: 8px;
4038
border-bottom: 1px solid var(--border);
41-
min-height: 32px;
4239
}
4340

4441
.path {
@@ -48,7 +45,7 @@
4845
.path-part {
4946
padding: 5px;
5047
border-radius: 3px;
51-
font-size: 1.2em;
48+
font-size: 1.02em;
5249
cursor: pointer;
5350

5451
&:not(:first-child) {
@@ -80,7 +77,7 @@
8077

8178
.dialog-entry {
8279
cursor: pointer;
83-
font-size: 1.2em;
80+
font-size: 1.02em;
8481
padding: 0px;
8582
padding-left: 8px;
8683
padding-right: 8px;

packages/vscode/src/dialog.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class Dialog {
110110
this.root.style.width = "850px";
111111
this.root.style.height = "600px";
112112
this.background.appendChild(this.root);
113-
document.body.appendChild(this.background);
113+
(document.getElementById("workbench.main.container") || document.body).appendChild(this.background);
114114
this.root.classList.add("dialog");
115115

116116
const setProperty = (vari: string, id: string): void => {

0 commit comments

Comments
 (0)