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.
This commit is contained in:
Leonard Kim 2017-04-12 17:19:37 -07:00 committed by Lyubo Marinov
parent a82bc1df64
commit 19de32e206
2 changed files with 9 additions and 2 deletions

View File

@ -56,7 +56,14 @@ export default class AbstractDialog extends Component {
/**
* Key to use for showing a title.
*/
titleKey: React.PropTypes.string
titleKey: React.PropTypes.string,
/**
* The string to use as a title instead of {@code titleKey}. If a truthy
* value is specified, it takes precedence over {@code titleKey} i.e.
* the latter is unused.
*/
titleString: React.PropTypes.string
}
/**

View File

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