55import * as Common from '../../core/common/common.js' ;
66import * as i18n from '../../core/i18n/i18n.js' ;
77import type * as SDK from '../../core/sdk/sdk.js' ;
8+ import * as Buttons from '../../ui/components/buttons/buttons.js' ;
9+ import * as Cards from '../../ui/components/cards/cards.js' ;
810import * as UI from '../../ui/legacy/legacy.js' ;
911import * as VisualLogging from '../../ui/visual_logging/visual_logging.js' ;
12+ import settingsScreenStyles from '../settings/settingsScreen.css.js' ;
1013
1114import throttlingSettingsTabStyles from './throttlingSettingsTab.css.js' ;
1215
1316const UIStrings = {
1417 /**
1518 *@description Text in Throttling Settings Tab of the Network panel
1619 */
17- networkThrottlingProfiles : 'Network Throttling Profiles ' ,
20+ networkThrottlingProfiles : 'Network throttling profiles ' ,
1821 /**
1922 *@description Text of add conditions button in Throttling Settings Tab of the Network panel
2023 */
21- addCustomProfile : 'Add custom profile... ' ,
24+ addCustomProfile : 'Add profile' ,
2225 /**
2326 *@description A value in milliseconds
2427 *@example {3} PH1
@@ -129,21 +132,30 @@ export class ThrottlingSettingsTab extends UI.Widget.VBox implements
129132
130133 this . element . setAttribute ( 'jslog' , `${ VisualLogging . pane ( 'throttling-conditions' ) } ` ) ;
131134
132- const header = this . contentElement . createChild ( 'div' , 'header' ) ;
133- header . textContent = i18nString ( UIStrings . networkThrottlingProfiles ) ;
134- UI . ARIAUtils . markAsHeading ( header , 1 ) ;
135-
136- const addButton =
137- UI . UIUtils . createTextButton ( i18nString ( UIStrings . addCustomProfile ) , this . addButtonClicked . bind ( this ) , {
138- className : 'add-conditions-button' ,
139- jslogContext : 'network.add-conditions' ,
140- } ) ;
141- this . contentElement . appendChild ( addButton ) ;
142-
135+ const settingsContent =
136+ this . contentElement . createChild ( 'div' , 'settings-card-container-wrapper' ) . createChild ( 'div' ) ;
137+ settingsContent . classList . add ( 'settings-card-container' , 'ignore-list-settings' ) ;
138+
139+ const addButton = new Buttons . Button . Button ( ) ;
140+ addButton . classList . add ( 'add-conditions-button' ) ;
141+ addButton . data = {
142+ variant : Buttons . Button . Variant . OUTLINED ,
143+ iconName : 'plus' ,
144+ jslogContext : 'network.add-conditions' ,
145+ } ;
146+ addButton . textContent = i18nString ( UIStrings . addCustomProfile ) ;
147+ addButton . addEventListener ( 'click' , ( ) => this . addButtonClicked ( ) ) ;
148+
149+ const listContainer = settingsContent . createChild ( 'div' ) ;
150+ const card = new Cards . Card . Card ( ) ;
151+ settingsContent . appendChild ( card ) ;
152+ card . data = {
153+ heading : i18nString ( UIStrings . networkThrottlingProfiles ) ,
154+ content : [ listContainer , addButton ] ,
155+ } ;
143156 this . list = new UI . ListWidget . ListWidget ( this ) ;
144157 this . list . element . classList . add ( 'conditions-list' ) ;
145-
146- this . list . show ( this . contentElement ) ;
158+ this . list . show ( listContainer ) ;
147159
148160 this . customSetting = Common . Settings . Settings . instance ( ) . moduleSetting ( 'custom-network-conditions' ) ;
149161 this . customSetting . addChangeListener ( this . conditionsUpdated , this ) ;
@@ -154,7 +166,7 @@ export class ThrottlingSettingsTab extends UI.Widget.VBox implements
154166 override wasShown ( ) : void {
155167 super . wasShown ( ) ;
156168 this . list . registerCSSFiles ( [ throttlingSettingsTabStyles ] ) ;
157- this . registerCSSFiles ( [ throttlingSettingsTabStyles ] ) ;
169+ this . registerCSSFiles ( [ throttlingSettingsTabStyles , settingsScreenStyles ] ) ;
158170 this . conditionsUpdated ( ) ;
159171 }
160172
0 commit comments