Переглянути джерело

Toolbar notice as React Component

j8
Ilya Daynatovich 8 роки тому
джерело
коміт
59a74153dc

+ 8
- 7
css/_notice.scss Переглянути файл

@@ -1,11 +1,12 @@
1
-#notice {
1
+.notice {
2 2
     position: relative;
3 3
     z-index: 3;
4 4
     margin-top: 6px;
5
+
6
+    &__message {
7
+        background-color: #000000;
8
+        color: white;
9
+        padding: 3px;
10
+        border-radius: 5px;
11
+    }
5 12
 }
6
-#noticeText {
7
-    background-color: #000000;
8
-    color: white;
9
-    padding: 3px;
10
-    border-radius: 5px;
11
-}

+ 0
- 6
modules/UI/UI.js Переглянути файл

@@ -315,12 +315,6 @@ UI.start = function () {
315 315
         // Initialise the recording module.
316 316
         if (config.enableRecording)
317 317
             Recording.init(eventEmitter, config.recordingType);
318
-
319
-        // Display notice message at the top of the toolbar
320
-        if (config.noticeMessage) {
321
-            $('#noticeText').text(config.noticeMessage);
322
-            UIUtil.setVisible('notice', true);
323
-        }
324 318
     } else {
325 319
         $("body").addClass("filmstrip-only");
326 320
         UIUtil.setVisible('mainToolbarContainer', false);

+ 3
- 20
react/features/conference/components/Conference.web.js Переглянути файл

@@ -8,23 +8,12 @@ import { DialogContainer } from '../../base/dialog';
8 8
 import { Watermarks } from '../../base/react';
9 9
 import { FeedbackButton } from '../../feedback';
10 10
 import { OverlayContainer } from '../../overlay';
11
+import { Notice } from '../../toolbar';
11 12
 import { HideNotificationBarStyle } from '../../unsupported-browser';
12 13
 
13 14
 declare var $: Function;
14 15
 declare var APP: Object;
15 16
 
16
-/**
17
- * For legacy reasons, inline style for display none.
18
- *
19
- * @private
20
- * @type {{
21
- *     display: string
22
- * }}
23
- */
24
-const _DISPLAY_NONE_STYLE = {
25
-    display: 'none'
26
-};
27
-
28 17
 /**
29 18
  * The conference page of the Web application.
30 19
  */
@@ -78,14 +67,8 @@ class Conference extends Component {
78 67
         return (
79 68
             <div id = 'videoconference_page'>
80 69
                 <div id = 'mainToolbarContainer'>
81
-                    <div
82
-                        className = 'notice'
83
-                        id = 'notice'
84
-                        style = { _DISPLAY_NONE_STYLE }>
85
-                        <span
86
-                            className = 'noticeText'
87
-                            id = 'noticeText' />
88
-                    </div>
70
+                    <Notice />
71
+
89 72
                     <div
90 73
                         className = 'toolbar'
91 74
                         id = 'mainToolbar' />

+ 52
- 0
react/features/toolbar/components/Notice.js Переглянути файл

@@ -0,0 +1,52 @@
1
+/* @flow */
2
+
3
+import React, { Component } from 'react';
4
+
5
+declare var config: Object;
6
+
7
+/**
8
+ * Notice react component.
9
+ *
10
+ * @class Notice
11
+ */
12
+export default class Notice extends Component {
13
+    state: Object;
14
+
15
+    /**
16
+     * Constructor of Notice component.
17
+     *
18
+     * @param {Object} props - The read-only React Component props with which
19
+     * the new instance is to be initialized.
20
+     */
21
+    constructor(props: Object) {
22
+        super(props);
23
+
24
+        const { noticeMessage } = config;
25
+
26
+        this.state = {
27
+            noticeMessage
28
+        };
29
+    }
30
+
31
+    /**
32
+     * Implements React's {@link Component#render()}.
33
+     *
34
+     * @inheritdoc
35
+     * @returns {ReactElement}
36
+     */
37
+    render() {
38
+        const { noticeMessage } = this.state;
39
+
40
+        if (!noticeMessage) {
41
+            return null;
42
+        }
43
+
44
+        return (
45
+            <div className = 'notice'>
46
+                <span className = 'notice__message' >
47
+                    { noticeMessage }
48
+                </span>
49
+            </div>
50
+        );
51
+    }
52
+}

+ 0
- 0
react/features/toolbar/components/Toolbar.web.js Переглянути файл


+ 1
- 0
react/features/toolbar/components/index.js Переглянути файл

@@ -1 +1,2 @@
1
+export { default as Notice } from './Notice';
1 2
 export { default as Toolbar } from './Toolbar';

Завантаження…
Відмінити
Зберегти