import React, { Component } from 'react' import styled from 'styled-components' import StopTimeForm from './StopTimeForm' const StyledRow = styled.div` padding-top: 5px; padding-bottom: 5px; background: white; margin-bottom: 1rem; ` class StopTimeOne extends Component { state = { editMode: false } constructor(props) { super(props) this.toggleEditMode = this.toggleEditMode.bind(this) } toggleEditMode() { this.setState({editMode: !this.state.editMode}) } renderReadOnly = (item) => ( Stop this.toggleEditMode()}>EDIT {item.sequence}. {item.stop.stop_id} Arrival {item.arrival} Departure {item.departure} Stop headsign {item.stop_headsign || '-'} ) render() { const { item } = this.props if (this.state.editMode) return return this.renderReadOnly(item) } } export default StopTimeOne
Stop this.toggleEditMode()}>EDIT
{item.sequence}. {item.stop.stop_id}
Arrival
{item.arrival}
Departure
{item.departure}
Stop headsign
{item.stop_headsign || '-'}