aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/app/components/StopItem.tsx
blob: ae51df86beea6c59ccbbe97fc93607c41e510974 (plain)
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
import React from "react";
import { Link } from "react-router";
import StopDataProvider, { type Stop } from "../data/StopDataProvider";
import LineIcon from "./LineIcon";
import { useApp } from "../AppContext";

interface StopItemProps {
  stop: Stop;
}

const StopItem: React.FC<StopItemProps> = ({ stop }) => {
  const { region } = useApp();

  return (
    <li className="list-item">
      <Link className="list-item-link" to={`/estimates/${stop.stopId}`}>
        {stop.favourite && <span className="favourite-icon"></span>} (
        {stop.stopId}) {StopDataProvider.getDisplayName(region, stop)}
        <div className="line-icons">
          {stop.lines?.map((line) => (
            <LineIcon key={line} line={line} region={region} />
          ))}
        </div>
      </Link>
    </li>
  );
};

export default StopItem;