Skip to content

Commit 2d49a33

Browse files
ktranDevtools-frontend LUCI CQ
authored andcommitted
[GM3Restyling] Unify and adjust infobar buttons
This CL makes the following changes to buttons: * differentiate between tonal, outlined and primary buttons * Change "Don't show again" button to come first, if any * removing icons and trailing dots from button text Screenshot: https://imgur.com/a/chAJH6W Bug: 325443174 Change-Id: Iba672a51f9c93ddb6547a5b48245e58128565091 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6325990 Reviewed-by: Kateryna Prokopenko <[email protected]> Commit-Queue: Kim-Anh Tran <[email protected]>
1 parent bbae85a commit 2d49a33

File tree

4 files changed

+25
-26
lines changed

4 files changed

+25
-26
lines changed

front_end/panels/sources/DebuggerPlugin.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -428,13 +428,6 @@ export class DebuggerPlugin extends Plugin {
428428
const infobar = new UI.Infobar.Infobar(
429429
UI.Infobar.Type.WARNING, i18nString(UIStrings.thisScriptIsOnTheDebuggersIgnore),
430430
[
431-
{
432-
text: i18nString(UIStrings.removeFromIgnoreList),
433-
highlight: false,
434-
delegate: unIgnoreList,
435-
dismiss: true,
436-
jslogContext: 'remove-from-ignore-list',
437-
},
438431
{
439432
text: i18nString(UIStrings.configure),
440433
highlight: false,
@@ -443,6 +436,14 @@ export class DebuggerPlugin extends Plugin {
443436
dismiss: false,
444437
jslogContext: 'configure',
445438
},
439+
{
440+
text: i18nString(UIStrings.removeFromIgnoreList),
441+
highlight: false,
442+
delegate: unIgnoreList,
443+
buttonVariant: Buttons.Button.Variant.TONAL,
444+
dismiss: true,
445+
jslogContext: 'remove-from-ignore-list',
446+
}
446447
],
447448
undefined, 'script-on-ignore-list');
448449
this.ignoreListInfobar = infobar;

front_end/panels/sources/SourcesNavigator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ const UIStrings = {
119119
* @description Button description in Workspaces tab in the Sources panel
120120
* to connect to an automatic workspace folder.
121121
*/
122-
automaticWorkspaceFolderConnect: 'Connect...',
122+
automaticWorkspaceFolderConnect: 'Connect',
123123
} as const;
124124
const str_ = i18n.i18n.registerUIStrings('panels/sources/SourcesNavigator.ts', UIStrings);
125125
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);

front_end/ui/legacy/Infobar.ts

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,28 @@ export class Infobar {
8181
ARIAUtils.markAsAlert(this.infoText);
8282

8383
this.actionContainer = this.infoContainer.createChild('div', 'infobar-info-actions');
84+
85+
let defaultActionButtonVariant = Buttons.Button.Variant.OUTLINED;
86+
this.disableSetting = disableSetting || null;
87+
if (disableSetting) {
88+
const disableButton = createTextButton(
89+
i18nString(UIStrings.dontShowAgain), this.onDisable.bind(this), {className: 'infobar-button'});
90+
this.actionContainer.appendChild(disableButton);
91+
92+
// If we have a disable button, make the other buttons tonal (if not otherwise specified).
93+
defaultActionButtonVariant = Buttons.Button.Variant.TONAL;
94+
}
8495
if (actions) {
8596
this.contentElement.setAttribute('role', 'group');
8697

8798
for (const action of actions) {
8899
const actionCallback = this.actionCallbackFactory(action);
89-
let buttonClass = 'infobar-button';
90-
if (action.highlight) {
91-
buttonClass += ' primary-button';
92-
}
93-
94-
const buttonVariant = action.buttonVariant ?? Buttons.Button.Variant.OUTLINED;
100+
const buttonVariant = action.buttonVariant ?? defaultActionButtonVariant;
95101

96102
const button = createTextButton(action.text, actionCallback, {
97-
className: buttonClass,
103+
className: 'infobar-button',
98104
jslogContext: action.jslogContext,
99105
variant: buttonVariant,
100-
icon: action.icon,
101106
});
102107
if (action.highlight && !this.#firstFocusableElement) {
103108
this.#firstFocusableElement = button;
@@ -106,13 +111,6 @@ export class Infobar {
106111
}
107112
}
108113

109-
this.disableSetting = disableSetting || null;
110-
if (disableSetting) {
111-
const disableButton = createTextButton(
112-
i18nString(UIStrings.dontShowAgain), this.onDisable.bind(this), {className: 'infobar-button'});
113-
this.actionContainer.appendChild(disableButton);
114-
}
115-
116114
this.closeContainer = this.mainRow.createChild('div', 'infobar-close-container');
117115
this.toggleElement = createTextButton(
118116
i18nString(UIStrings.showMore), this.onToggleDetails.bind(this),
@@ -243,7 +241,6 @@ export interface InfobarAction {
243241
delegate: (() => void)|null;
244242
dismiss: boolean;
245243
buttonVariant?: Buttons.Button.Variant;
246-
icon?: string;
247244
jslogContext?: string;
248245
}
249246

front_end/ui/legacy/InspectorView.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const UIStrings = {
7272
/**
7373
*@description Title of an action that reloads the tab currently being debugged by DevTools
7474
*/
75-
reloadDebuggedTab: 'Reload',
75+
reloadDebuggedTab: 'Reload page',
7676
/**
7777
*@description Title of an action that reloads the DevTools
7878
*/
@@ -492,7 +492,6 @@ export class InspectorView extends VBox implements ViewLocationResolver {
492492
},
493493
dismiss: false,
494494
buttonVariant: Buttons.Button.Variant.PRIMARY,
495-
icon: 'refresh',
496495
jslogContext: 'main.debug-reload',
497496
},
498497
],
@@ -522,6 +521,7 @@ export class InspectorView extends VBox implements ViewLocationResolver {
522521
highlight: true,
523522
delegate: () => reloadDevTools(),
524523
dismiss: false,
524+
buttonVariant: Buttons.Button.Variant.PRIMARY,
525525
jslogContext: 'main.debug-reload',
526526
},
527527
],
@@ -545,6 +545,7 @@ export class InspectorView extends VBox implements ViewLocationResolver {
545545
highlight: true,
546546
delegate: () => callback(),
547547
dismiss: true,
548+
buttonVariant: Buttons.Button.Variant.TONAL,
548549
jslogContext: 'select-folder',
549550
},
550551
],

0 commit comments

Comments
 (0)