aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/app/components/StopItem.tsx
blob: 7875b59f37762567c60ba1b73b9ecd3fd701364b (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
30
31
32
33
import React from "react";
import { Link } from "react-router";
import StopDataProvider, { type Stop } from "../data/StopDataProvider";
import LineIcon from "./LineIcon";

interface StopItemProps {
  stop: Stop;
}

const StopItem: React.FC<StopItemProps> = ({ stop }) => {
  return (
    <li className="list-item">
      <Link className="list-item-link" to={`/stops/${stop.stopId}`}>
        <div style={{ display: "flex", justifyContent: "space-between", alignItems: "baseline" }}>
          <span style={{ fontWeight: 600 }}>
            {stop.favourite && <span className="favourite-icon"></span>}
            {StopDataProvider.getDisplayName(stop)}
          </span>
          <span style={{ fontSize: "0.85em", color: "var(--subtitle-color)", marginLeft: "0.5rem" }}>
            ({stop.stopId})
          </span>
        </div>
        <div className="line-icons" style={{ marginTop: "0.25rem" }}>
          {stop.lines?.map((line) => (
            <LineIcon key={line} line={line} />
          ))}
        </div>
      </Link>
    </li>
  );
};

export default StopItem;