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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | import { Button } from "@wintermuted/ui-react";
import React from "react";
import type { ArrivalLocation } from "../../../api/trimet/interfaces/arrivals";
import { OnBookmarkClick } from "./StopLocationView";
interface StopLocationHeaderProps {
location: ArrivalLocation;
stopIsBookmarked: boolean;
onBookmarkClick: OnBookmarkClick;
}
function getButton(
location: ArrivalLocation,
stopIsBookmarked: boolean,
onBookmarkClick: OnBookmarkClick
) {
function onClick() {
onBookmarkClick(location, stopIsBookmarked);
}
return (
<Button
type="button"
variant="secondary"
aria-pressed={stopIsBookmarked}
onClick={onClick}
className="transit-responsive-margin"
style={{ marginBottom: ".5rem" }}
>
{stopIsBookmarked ? "Remove Bookmark" : "Add Bookmark"}
</Button>
);
}
function StopLocationHeader({
location,
onBookmarkClick,
stopIsBookmarked
}: StopLocationHeaderProps) {
return (
<>
<header
className="transit-responsive-nowrap"
style={{
display: "flex",
justifyContent: "space-between",
flexWrap: "wrap",
paddingTop: "1rem",
paddingBottom: ".5rem",
marginBottom: "1rem"
}}
>
<h2 style={{ fontSize: "clamp(1.75rem, 4vw, 2.5rem)" }}>
{location.desc}
</h2>
{getButton(location, stopIsBookmarked, onBookmarkClick)}
</header>
<hr />
</>
);
}
export default StopLocationHeader;
|