Browse Source

Fixed "add program item" button showing while not editing

update-deps
Alex Mikhalev 7 years ago
parent
commit
5d3b633f52
  1. 14
      app/components/ProgramSequenceView.tsx

14
app/components/ProgramSequenceView.tsx

@ -120,6 +120,15 @@ class ProgramSequenceView extends React.Component<{ @@ -120,6 +120,15 @@ class ProgramSequenceView extends React.Component<{
const { sequence, sections } = this.props;
const editing = this.props.editing || false;
const className = classNames("programSequence", { editing });
let addButton: React.ReactNode = null;
if (editing) {
addButton = (
<Button onClick={this.addItem}>
<Icon name="add"/>
Add item
</Button>
);
}
return (
<div>
<ProgramSequenceList
@ -133,10 +142,7 @@ class ProgramSequenceView extends React.Component<{ @@ -133,10 +142,7 @@ class ProgramSequenceView extends React.Component<{
onRemove={this.removeItem}
onSortEnd={this.onSortEnd}
/>
<Button onClick={this.addItem}>
<Icon name="add"/>
Add item
</Button>
{addButton}
</div>
);
}

Loading…
Cancel
Save