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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | 216x 216x 216x | import React, { useId } from "react";
import "./PlaceDetailsPanel.scss";
export interface PlaceDetailsPanelProps {
name: string;
category: React.ReactNode;
headingId?: string;
headingRef?: React.Ref<HTMLHeadingElement>;
status?: React.ReactNode;
bookmarkAction?: React.ReactNode;
address?: string;
children?: React.ReactNode;
arrivalNotice: React.ReactNode;
tripAction: React.ReactNode;
sourceUrl?: string;
website?: string;
sourceDate?: string;
sourceLabel?: string;
websiteLabel?: string;
}
export function PlaceDetailsPanel({
name,
category,
headingId,
headingRef,
status,
bookmarkAction,
address,
children,
arrivalNotice,
tripAction,
sourceUrl,
website,
sourceDate,
sourceLabel = "View source location",
websiteLabel = "Website",
}: PlaceDetailsPanelProps) {
const id = useId();
const titleId = headingId || `${id}-heading`;
return (
<section className="transit-place-detail" aria-labelledby={titleId}>
<div className="transit-place-detail-heading">
<h2 id={titleId} ref={headingRef} tabIndex={-1}>
{name}
</h2>
{status}
</div>
<p>{category}</p>
{bookmarkAction}
{address && <p>{address}</p>}
{children}
<p>{arrivalNotice}</p>
{tripAction}
{(sourceUrl || website || sourceDate) && (
<p className="transit-place-source">
{sourceUrl && (
<a href={sourceUrl} target="_blank" rel="noreferrer">
{sourceLabel}
</a>
)}
{website && (
<>
{sourceUrl && <> ยท </>}
<a href={website} target="_blank" rel="noreferrer">
{websiteLabel}
</a>
</>
)}
{sourceDate && (
<>
{(sourceUrl || website) && <br />}Source data as of {sourceDate}.
</>
)}
</p>
)}
</section>
);
}
|