26 lines
585 B
JavaScript
26 lines
585 B
JavaScript
import { h, Component } from 'preact';
|
|
|
|
import Link from './Link';
|
|
|
|
import formatTime from '../util/formatTime';
|
|
|
|
export default class Result extends Component {
|
|
toggle() {
|
|
console.log('toggle');
|
|
this.setState({
|
|
expand: !this.state.expand,
|
|
})
|
|
}
|
|
|
|
render(props, { expand }) {
|
|
return (
|
|
<li className={{ expand }} onClick={() => this.toggle()}>
|
|
{formatTime(props.DepDateTime)} - {formatTime(props.ArrDateTime)}
|
|
<ul>
|
|
{props.RouteLinks.RouteLink.map((link, i) => <Link key={i} {...link} />)}
|
|
</ul>
|
|
</li>
|
|
);
|
|
}
|
|
}
|