Browse Source

Abstract the DialogWithTabs title so it can be reused with other components

master
mmoanis 6 years ago
parent
commit
b844a9f06b

+ 13
- 3
react/features/base/dialog/components/DialogWithTabs.web.js View File

@@ -18,6 +18,11 @@ export type Props = {
18 18
      */
19 19
     closeDialog: Function,
20 20
 
21
+    /**
22
+     * Css class name that will be added to the dialog.
23
+     */
24
+    cssClassName: string,
25
+
21 26
     /**
22 27
      * Which settings tab should be initially displayed. If not defined then
23 28
      * the first tab will be displayed.
@@ -44,7 +49,12 @@ export type Props = {
44 49
     /**
45 50
      * Information about the tabs that will be rendered.
46 51
      */
47
-    tabs: Array<Object>
52
+    tabs: Array<Object>,
53
+
54
+    /**
55
+     * Key to use for showing a title.
56
+     */
57
+    titleKey: string
48 58
 
49 59
 };
50 60
 
@@ -102,8 +112,8 @@ class DialogWithTabs extends Component<Props, State> {
102 112
                     = { this.props.disableBlanketClickDismiss }
103 113
                 onCancel = { onCancel }
104 114
                 onSubmit = { this._onSubmit }
105
-                titleKey = 'settings.title'>
106
-                <div className = 'settings-dialog'>
115
+                titleKey = { this.props.titleKey } >
116
+                <div className = { this.props.cssClassName } >
107 117
                     { this._renderTabs() }
108 118
                 </div>
109 119
             </StatelessDialog>

+ 3
- 1
react/features/settings/DeviceSelectionPopup.js View File

@@ -262,13 +262,15 @@ export default class DeviceSelectionPopup {
262 262
                 <AtlasKitThemeProvider mode = 'dark'>
263 263
                     <DialogWithTabs
264 264
                         closeDialog = { this.close }
265
+                        cssClassName = 'settings-dialog'
265 266
                         onSubmit = { onSubmit }
266 267
                         tabs = { [ {
267 268
                             component: DeviceSelection,
268 269
                             label: 'settings.devices',
269 270
                             props: this._dialogProps,
270 271
                             submit: this._onSubmit
271
-                        } ] } />
272
+                        } ] }
273
+                        titleKey = 'settings.title' />
272 274
                 </AtlasKitThemeProvider>
273 275
             </I18nextProvider>,
274 276
             document.getElementById('react'));

+ 3
- 1
react/features/settings/components/web/SettingsDialog.js View File

@@ -91,11 +91,13 @@ class SettingsDialog extends Component<Props> {
91 91
         return (
92 92
             <DialogWithTabs
93 93
                 closeDialog = { this._closeDialog }
94
+                cssClassName = 'settings-dialog'
94 95
                 defaultTab = {
95 96
                     defaultTabIdx === -1 ? undefined : defaultTabIdx
96 97
                 }
97 98
                 onSubmit = { onSubmit }
98
-                tabs = { tabs } />
99
+                tabs = { tabs }
100
+                titleKey = 'settings.title' />
99 101
         );
100 102
     }
101 103
 

Loading…
Cancel
Save