Skip to content

Commit 8038d1c

Browse files
ktranDevtools-frontend LUCI CQ
authored andcommitted
[GM3Restyling] Update general info bar styles to look like Chrome's
This CL changes the general style of the infobar: * info infobars adopt Chrome's infobar's background color (white) * icon and close button sizes * paddings, alignments, fonts Before: https://i.imgur.com/f5M7Woz.png After: https://i.imgur.com/gPCuRHL.png Drive-by: Use icon component instead of mask images for icons Bug: 325443174 Change-Id: I88910f7ad17ffb568e9728bbea66e26a11f897f7 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6321790 Commit-Queue: Kim-Anh Tran <[email protected]> Reviewed-by: Kateryna Prokopenko <[email protected]>
1 parent 565d4c5 commit 8038d1c

File tree

4 files changed

+37
-19
lines changed

4 files changed

+37
-19
lines changed

front_end/panels/sources/SourcesNavigator.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ export class FilesNavigatorView extends NavigatorView {
199199

200200
constructor() {
201201
super('navigator-files');
202+
this.registerRequiredCSS(sourcesNavigatorStyles);
202203
const placeholder =
203204
new UI.EmptyWidget.EmptyWidget(i18nString(UIStrings.noWorkspace), i18nString(UIStrings.explainWorkspace));
204205
this.setPlaceholder(placeholder);
@@ -268,6 +269,7 @@ export class FilesNavigatorView extends NavigatorView {
268269
'automatic-workspace-folders',
269270
);
270271
if (this.#infobar) {
272+
this.#infobar.element.classList.add('automatic-workspace-infobar');
271273
this.contentElement.append(this.#infobar.element);
272274
}
273275
}

front_end/panels/sources/sourcesNavigator.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@
88
border-bottom: 1px solid var(--sys-color-divider);
99
flex-shrink: 0;
1010
}
11+
12+
.automatic-workspace-infobar {
13+
border-top: var(--sys-size-1) solid var(--sys-color-divider);
14+
}

front_end/ui/legacy/Infobar.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type * as Common from '../../core/common/common.js';
66
import * as i18n from '../../core/i18n/i18n.js';
77
import * as Buttons from '../../ui/components/buttons/buttons.js';
88
import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
9+
import * as IconButton from '../components/icon_button/icon_button.js';
910

1011
import * as ARIAUtils from './ARIAUtils.js';
1112
import infobarStyles from './infobar.css.js';
@@ -72,8 +73,8 @@ export class Infobar {
7273

7374
this.infoMessage = this.infoContainer.createChild('div', 'infobar-info-message');
7475

75-
// Icon is in separate file and included via CSS.
76-
this.infoMessage.createChild('div', type + '-icon icon');
76+
const icon = IconButton.Icon.create(TYPE_TO_ICON[type], type + '-icon');
77+
this.infoMessage.appendChild(icon);
7778

7879
this.infoText = this.infoMessage.createChild('div', 'infobar-info-text');
7980
this.infoText.textContent = text;
@@ -120,6 +121,7 @@ export class Infobar {
120121
this.closeContainer.appendChild(this.toggleElement);
121122
this.closeButton = this.closeContainer.createChild('dt-close-button', 'close-button');
122123
this.closeButton.setTabbable(true);
124+
this.closeButton.setSize(Buttons.Button.Size.SMALL);
123125
ARIAUtils.setDescription(this.closeButton, i18nString(UIStrings.close));
124126
self.onInvokeElement(this.closeButton, this.dispose.bind(this));
125127

@@ -251,3 +253,10 @@ export const enum Type {
251253
ISSUE = 'issue',
252254
ERROR = 'error',
253255
}
256+
257+
const TYPE_TO_ICON = {
258+
[Type.WARNING]: 'warning',
259+
[Type.INFO]: 'info',
260+
[Type.ISSUE]: 'issue-text-filled',
261+
[Type.ERROR]: 'cross-circle',
262+
};

front_end/ui/legacy/infobar.css

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717

1818
.infobar {
1919
color: var(--sys-color-on-surface);
20-
background-color: var(--sys-color-surface1);
20+
background-color: var(--sys-color-cdt-base-container);
2121
display: flex;
2222
flex: auto;
2323
flex-direction: column;
2424
position: relative;
25-
padding: 6px;
25+
padding: var(--sys-size-5) var(--sys-size-8);
2626
min-width: fit-content;
2727
}
2828

@@ -60,13 +60,14 @@
6060

6161
.infobar-info-message {
6262
display: flex;
63-
margin: 5px 0;
63+
align-items: center;
6464
}
6565

6666
.infobar-info-text {
6767
display: flex;
6868
align-items: center;
69-
margin: 0 4px;
69+
font: var(--sys-typescale-body3-regular);
70+
margin: 0 var(--sys-size-8);
7071
}
7172

7273
.infobar-details-rows {
@@ -96,36 +97,38 @@
9697

9798
.infobar-button {
9899
color: var(--sys-color-token-subtle);
99-
padding: 0 4px;
100100
}
101101

102102
.info-icon {
103-
mask-image: var(--image-file-info);
104-
background-color: var(--sys-color-primary);
103+
color: var(--sys-color-primary);
105104
}
106105

107106
.warning-icon {
108-
mask-image: var(--image-file-warning);
109-
background-color: var(--icon-warning);
107+
color: var(--icon-warning);
110108
}
111109

112110
.error-icon {
113-
mask-image: var(--image-file-cross-circle);
114-
background-color: var(--icon-error);
111+
color: var(--icon-error);
115112
}
116113

117114
.issue-icon {
118-
mask-image: var(--image-file-issue-text-filled);
119-
background-color: var(--sys-color-primary);
115+
color: var(--sys-color-primary);
120116
}
121117

122-
.icon {
123-
mask-size: 20px 20px;
124-
width: 20px;
125-
height: 20px;
118+
.info-icon,
119+
.warning-icon,
120+
.error-icon,
121+
.issue-icon {
122+
width: var(--sys-size-8);
123+
height: var(--sys-size-8);
126124
flex-shrink: 0;
127125
}
128126

127+
.infobar-info-actions {
128+
display: flex;
129+
gap: var(--sys-size-3);
130+
}
131+
129132
.devtools-link.text-button:hover,
130133
.devtools-link.text-button:focus,
131134
.devtools-link.text-button:active {

0 commit comments

Comments
 (0)