Skip to content

Commit c5a9280

Browse files
authored
ButtonWithDropdown separator style update (microsoft#154109)
1 parent ed3dca0 commit c5a9280

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/vs/base/browser/ui/button/button.css

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,13 @@
4242
outline-offset: -1px !important;
4343
}
4444

45-
.monaco-button-dropdown > .monaco-dropdown-button {
46-
margin-left: 1px;
45+
.monaco-button-dropdown .monaco-button-dropdown-separator {
46+
padding: 4px 0;
47+
}
48+
49+
.monaco-button-dropdown .monaco-button-dropdown-separator > div {
50+
height: 100%;
51+
width: 1px;
4752
}
4853

4954
.monaco-description-button {

src/vs/base/browser/ui/button/button.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ export class ButtonWithDropdown extends Disposable implements IButton {
247247
private readonly button: Button;
248248
private readonly action: Action;
249249
private readonly dropdownButton: Button;
250+
private readonly separatorContainer: HTMLDivElement;
251+
private readonly separator: HTMLDivElement;
250252

251253
readonly element: HTMLElement;
252254
private readonly _onDidClick = this._register(new Emitter<Event | undefined>());
@@ -263,6 +265,13 @@ export class ButtonWithDropdown extends Disposable implements IButton {
263265
this._register(this.button.onDidClick(e => this._onDidClick.fire(e)));
264266
this.action = this._register(new Action('primaryAction', this.button.label, undefined, true, async () => this._onDidClick.fire(undefined)));
265267

268+
this.separatorContainer = document.createElement('div');
269+
this.separatorContainer.classList.add('monaco-button-dropdown-separator');
270+
271+
this.separator = document.createElement('div');
272+
this.separatorContainer.appendChild(this.separator);
273+
this.element.appendChild(this.separatorContainer);
274+
266275
this.dropdownButton = this._register(new Button(this.element, { ...options, title: false, supportIcons: true }));
267276
this.dropdownButton.element.title = localize("button dropdown more actions", 'More Actions...');
268277
this.dropdownButton.element.classList.add('monaco-dropdown-button');
@@ -299,6 +308,10 @@ export class ButtonWithDropdown extends Disposable implements IButton {
299308
style(styles: IButtonStyles): void {
300309
this.button.style(styles);
301310
this.dropdownButton.style(styles);
311+
312+
// Separator
313+
this.separatorContainer.style.backgroundColor = styles.buttonBackground?.toString() ?? '';
314+
this.separator.style.backgroundColor = styles.buttonForeground?.toString() ?? '';
302315
}
303316

304317
focus(): void {

0 commit comments

Comments
 (0)