import * as React from 'react'; import { Draggable } from 'react-beautiful-dnd'; import PostStatusLabel from "../../shared/PostStatusLabel"; import DragZone from '../../shared/DragZone'; import Separator from '../../shared/Separator'; import PostStatusForm from './PostStatusForm'; interface Props { id: number; name: string; color: string; index: number; settingsAreUpdating: boolean; handleUpdate( id: number, name: string, color: string, onSuccess: Function, ): void; handleDelete(id: number): void; } interface State { editMode: boolean; } class PostStatusEditable extends React.Component { constructor(props) { super(props); this.state = { editMode: false, }; this.toggleEditMode = this.toggleEditMode.bind(this); this.handleUpdate = this.handleUpdate.bind(this); } toggleEditMode() { this.setState({editMode: !this.state.editMode}); } handleUpdate(id: number, name: string, color: string) { this.props.handleUpdate( id, name, color, () => this.setState({editMode: false}), ); } render() { const { id, name, color, index, settingsAreUpdating, handleDelete } = this.props; const {editMode} = this.state; return ( {provided => (
  • { editMode === false ? : Cancel }
  • )}
    ); } } export default PostStatusEditable;