mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 05:55:00 +08:00
Hide add button when new item field is empty
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
ffe2727cf7
commit
fa99c2e8c5
@ -118,15 +118,23 @@ export default class EditableItemList extends React.Component {
|
||||
};
|
||||
|
||||
_renderNewItemField() {
|
||||
let addButton;
|
||||
console.log(this.props.newItem);
|
||||
if (this.props.newItem) {
|
||||
addButton = (
|
||||
<AccessibleButton onClick={this._onItemAdded} kind="primary" type="submit">
|
||||
{_t("Add")}
|
||||
</AccessibleButton>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<form onSubmit={this._onItemAdded} autoComplete="off"
|
||||
noValidate={true} className="mx_EditableItemList_newItem">
|
||||
<Field label={this.props.placeholder} type="text"
|
||||
autoComplete="off" value={this.props.newItem || ""} onChange={this._onNewItemChanged}
|
||||
list={this.props.suggestionsListId} />
|
||||
<AccessibleButton onClick={this._onItemAdded} kind="primary" type="submit">
|
||||
{_t("Add")}
|
||||
</AccessibleButton>
|
||||
{ addButton }
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user