All files / applications/go-by-transit/src/view/nearbyStops/components StopInfo.tsx

100% Statements 4/4
100% Branches 4/4
100% Functions 1/1
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37                            10x 1x     9x 10x                                  
import { Card, CardBody, CardHeader } from "@wintermuted/ui-react";
import React from "react";
import { TrimetRoute } from "../../../api/trimet/interfaces/types";
import StopLocationIndicator from "../../../component/stop/StopLocationIndicator";
import { StopLocationWithDistance } from "../../../state/arrivals/formatStopLocations";
import "./StopInfo.css";
import StopRouteListing from "./StopRouteListing";
 
interface Props {
  stopLocation: StopLocationWithDistance;
  onClick: (route: TrimetRoute) => void;
}
 
export default function StopInfo({ stopLocation, onClick }: Props) {
  if (!stopLocation) {
    return null;
  }
 
  const id = stopLocation.locid ? stopLocation.locid : stopLocation.id;
  return (
    <Card className="stop-info-header">
      <CardHeader>
        <h3 style={{ fontSize: "1rem" }}>
          <StopLocationIndicator locationId={id} />
          <span className="stop-info">
            {stopLocation.desc} - {stopLocation.dir} -
          </span>
          <span>{stopLocation.distance} feet away</span>
        </h3>
      </CardHeader>
      <CardBody>
        <StopRouteListing routes={stopLocation.route} onClick={onClick} />
      </CardBody>
    </Card>
  );
}