gtfs-display/src/components/agency-per-day-table.js

50 lines
1.2 KiB
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
import AgencyPerDayTableEntries from './agency-per-day-table-entries';
/* destructure props object */
export default function AgencyPerDayTable({ array, title, date }) {
if (array !== undefined && array !== null) {
/* return a React element */
return (
<>
<p>
Table of
{array.length}
{title}
{' '}
for
{date}
:
</p>
<table>
<thead>
<tr>
<th>agency_name&nbsp;|</th>
<th>agency_id&nbsp;|</th>
<th>route_id&nbsp;|</th>
<th>route_short_name&nbsp;|</th>
<th>abs. trip count&nbsp;|</th>
<th>RT TU count&nbsp;|</th>
<th>RT TU %&nbsp;|</th>
<th>latest RT timestamp&nbsp;|</th>
</tr>
</thead>
<tbody>
<AgencyPerDayTableEntries array={array} />
</tbody>
</table>
</>
);
}
return (
<p>loading...</p>
);
}
AgencyPerDayTable.propTypes = {
array: PropTypes.array,
title: PropTypes.string,
date: PropTypes.string,
};