All files / applications/go-by-transit/src/view/bookmarks/component BookmarkedRouteItem.tsx

100% Statements 2/2
75% Branches 3/4
100% Functions 2/2
100% Lines 2/2

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                      3x             1x                  
import { Button } from "@wintermuted/ui-react";
import React from "react";
import { Link } from "react-router-dom";
import { RouteBookmark } from "../../../api/localstorage/routeBookmarks";
 
interface Props {
  route: RouteBookmark;
  onRemove?: (routeId: number) => void;
}
 
export default function BookmarkedRouteItem({ route, onRemove }: Props) {
  return (
    <li className="bookmark-stop-wrapper">
      <Link to={`/lines/${route.route}`}>
        Route {route.route}: {route.desc || "Transit route"}
      </Link>
      {onRemove && (
        <Button
          onClick={() => onRemove(route.route)}
          aria-label={`Remove Route ${route.route} from bookmarks`}
        >
          Remove
        </Button>
      )}
    </li>
  );
}