Browse Source

feat: support directly setting dialog title text

Dialog does not currently support displaying dynamic strings
for titles, only static strings listed for translation. Accept
a new prop that explicitly states it is for setting the title
and have the web dialog prefer it over the titleKey.
master
Leonard Kim 8 years ago
parent
commit
19de32e206

+ 8
- 1
react/features/base/dialog/components/AbstractDialog.js View File

@@ -56,7 +56,14 @@ export default class AbstractDialog extends Component {
56 56
         /**
57 57
          * Key to use for showing a title.
58 58
          */
59
-        titleKey: React.PropTypes.string
59
+        titleKey: React.PropTypes.string,
60
+
61
+        /**
62
+         * The string to use as a title instead of {@code titleKey}. If a truthy
63
+         * value is specified, it takes precedence over {@code titleKey} i.e.
64
+         * the latter is unused.
65
+         */
66
+        titleString: React.PropTypes.string
60 67
     }
61 68
 
62 69
     /**

+ 1
- 1
react/features/base/dialog/components/Dialog.web.js View File

@@ -114,7 +114,7 @@ class Dialog extends AbstractDialog {
114 114
         return (
115 115
             <header>
116 116
                 <h2>
117
-                    { t(this.props.titleKey) }
117
+                    { this.props.titleString || t(this.props.titleKey) }
118 118
                 </h2>
119 119
             </header>
120 120
         );

Loading…
Cancel
Save