replace text Inputs in Devtools with Field bcuz prettier

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2019-02-24 04:28:42 +00:00
parent 150c941340
commit dbf540074d

View file

@ -20,6 +20,7 @@ import sdk from '../../../index';
import SyntaxHighlight from '../elements/SyntaxHighlight'; import SyntaxHighlight from '../elements/SyntaxHighlight';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
import MatrixClientPeg from '../../../MatrixClientPeg'; import MatrixClientPeg from '../../../MatrixClientPeg';
import Field from "../elements/Field";
class DevtoolsComponent extends React.Component { class DevtoolsComponent extends React.Component {
static contextTypes = { static contextTypes = {
@ -56,14 +57,8 @@ class GenericEditor extends DevtoolsComponent {
} }
textInput(id, label) { textInput(id, label) {
return <div className="mx_DevTools_inputRow"> return <Field id={id} label={label} size="32" autoFocus={true} type="text" autoComplete="on"
<div className="mx_DevTools_inputLabelCell"> value={this.state[id]} onChange={this._onChange} />;
<label htmlFor={id}>{ label }</label>
</div>
<div className="mx_DevTools_inputCell">
<input id={id} className="mx_TextInputDialog_input" onChange={this._onChange} value={this.state[id]} size="32" autoFocus={true} />
</div>
</div>;
} }
} }
@ -138,12 +133,9 @@ class SendCustomEvent extends GenericEditor {
<br /> <br />
<div className="mx_DevTools_inputLabelCell"> <Field id="evContent" label={_t("Event Content")} type="text" className="mx_DevTools_textarea"
<label htmlFor="evContent"> { _t('Event Content') } </label> autoComplete="off" value={this.state.evContent} onChange={this._onChange} element="textarea" />
</div>
<div>
<textarea id="evContent" onChange={this._onChange} value={this.state.evContent} className="mx_DevTools_textarea" />
</div>
</div> </div>
<div className="mx_Dialog_buttons"> <div className="mx_Dialog_buttons">
<button onClick={this.onBack}>{ _t('Back') }</button> <button onClick={this.onBack}>{ _t('Back') }</button>
@ -302,14 +294,12 @@ class FilteredList extends React.Component {
render() { render() {
const TruncatedList = sdk.getComponent("elements.TruncatedList"); const TruncatedList = sdk.getComponent("elements.TruncatedList");
return <div> return <div>
<input size="64" <Field id="DevtoolsDialog_FilteredList_filter" label={_t('Filter results')} autoFocus={true} size={64}
autoFocus={true} type="text" autoComplete="off" value={this.props.query} onChange={this.onQuery}
onChange={this.onQuery}
value={this.props.query}
placeholder={_t('Filter results')}
className="mx_TextInputDialog_input mx_DevTools_RoomStateExplorer_query" className="mx_TextInputDialog_input mx_DevTools_RoomStateExplorer_query"
// force re-render so that autoFocus is applied when this component is re-used // force re-render so that autoFocus is applied when this component is re-used
key={this.props.children[0] ? this.props.children[0].key : ''} /> key={this.props.children[0] ? this.props.children[0].key : ''} />
<TruncatedList getChildren={this.getChildren} <TruncatedList getChildren={this.getChildren}
getChildCount={this.getChildCount} getChildCount={this.getChildCount}
truncateAt={this.state.truncateAt} truncateAt={this.state.truncateAt}