import React, { Component } from 'react'; import { Link } from 'react-router-dom'; import './css/TrafficInfo.css'; import busIcon from '../img/bus.svg'; import warningIcon from '../img/warning.svg'; class TrafficEntry extends Component { state = { expanded: false }; toggle = () => { if (this.state.expanded) this.collapse(); else this.expand(); }; expand = () => { this.setState({ expanded: true }); }; collapse = () => { this.setState({ expanded: false }); }; render() { let trafficInfo = this.props.departure.trafficInfo; let lineInterference = trafficInfo !== "" && trafficInfo !== null && trafficInfo !== undefined; return (
{!lineInterference && {this.props.departure.originalTime} } {lineInterference && <>
{this.props.departure.newTime} {this.props.departure.originalTime}
}
{this.props.departure.lineName} {"Mot " + this.props.departure.finalStop}
{lineInterference &&

{trafficInfo}

Visa mer
}
{lineInterference && Hitta annan resväg }
); } } export default TrafficEntry;