gtfs-display/src/components/trips-route-day-table.js

47 lines
1.0 KiB
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
import TableEntries from './trips-route-day-table-entries';
/* destructure props object */
export default function TripsRouteDayTable({ array, title }) {
if (array !== undefined && array !== null) {
/* return a React element */
return (
<>
<p>
Table of
{array.length}
{title}
{' '}
for today:
</p>
<table>
<thead>
<tr>
<th>agency_name</th>
<th>agency_id</th>
<th>route_id</th>
<th>route_short_name</th>
<th>service_id</th>
<th>trip_id</th>
<th>trip_short_name</th>
<th>trip_headsign</th>
</tr>
</thead>
<tbody>
<TableEntries array={array} />
</tbody>
</table>
</>
);
}
return (
<p>loading...</p>
);
}
TripsRouteDayTable.propTypes = {
array: PropTypes.array,
title: PropTypes.string,
};