Fix Account Selection in Signer (#4744)

* Can pass FormattedMessage to Input (eg. Status // RPC Enabled)

* Simple fixed-width fix for Accoutn Selection in Parity Signer
This commit is contained in:
Nicolas Gotchac 2017-03-03 14:32:52 +01:00 committed by Jaco Greeff
parent fd19f6f449
commit 5559374676
2 changed files with 16 additions and 2 deletions

View File

@ -46,6 +46,10 @@ const UNDERLINE_FOCUSED = {
const NAME_ID = ' '; const NAME_ID = ' ';
export default class Input extends Component { export default class Input extends Component {
static contextTypes = {
intl: React.PropTypes.object.isRequired
};
static propTypes = { static propTypes = {
allowCopy: PropTypes.oneOfType([ allowCopy: PropTypes.oneOfType([
PropTypes.string, PropTypes.string,
@ -79,7 +83,8 @@ export default class Input extends Component {
style: PropTypes.object, style: PropTypes.object,
value: PropTypes.oneOfType([ value: PropTypes.oneOfType([
PropTypes.number, PropTypes.number,
PropTypes.string PropTypes.string,
PropTypes.node
]) ])
}; };
@ -135,6 +140,13 @@ export default class Input extends Component {
? UNDERLINE_FOCUSED ? UNDERLINE_FOCUSED
: readOnly && typeof focused !== 'boolean' ? { display: 'none' } : null; : readOnly && typeof focused !== 'boolean' ? { display: 'none' } : null;
const textValue = typeof value !== 'string' && (value && value.props)
? this.context.intl.formatMessage(
value.props,
value.props.values || {}
)
: value;
return ( return (
<div className={ styles.container } style={ style }> <div className={ styles.container } style={ style }>
{ this.renderCopyButton() } { this.renderCopyButton() }
@ -169,7 +181,7 @@ export default class Input extends Component {
underlineStyle={ underlineStyle } underlineStyle={ underlineStyle }
underlineFocusStyle={ underlineFocusStyle } underlineFocusStyle={ underlineFocusStyle }
underlineShow={ !hideUnderline } underlineShow={ !hideUnderline }
value={ value } value={ textValue }
> >
{ children } { children }
</TextField> </TextField>

View File

@ -42,6 +42,7 @@ $modalZ: 10001;
.container { .container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 100%;
} }
.overlay { .overlay {
@ -106,6 +107,7 @@ $modalZ: 10001;
min-height: 30vh; min-height: 30vh;
max-height: 80vh; max-height: 80vh;
max-width: calc(100vw - 2em); max-width: calc(100vw - 2em);
width: 960px;
.content { .content {
flex: 1; flex: 1;