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 | 890x 890x 851x 55x 54x | import { DetailHeader } from "@overworld/ui";
import React from "react";
import { Link } from "react-router-dom";
interface TopNavBarParams {
id: string;
shortSign?: string;
subtitle?: string;
backTo?: string;
onBack?: () => void;
truncateTitle?: boolean;
action?: React.ReactNode;
}
export function TopNavBar({
id,
shortSign,
subtitle,
truncateTitle = false,
action,
onBack,
backTo,
}: TopNavBarParams) {
const title = shortSign ? `${id} to ${shortSign}` : id;
return (
<DetailHeader
title={title}
subtitle={subtitle}
truncateTitle={truncateTitle}
action={action}
onBack={onBack}
renderBack={
onBack && !backTo
? undefined
: (props) => (
<Link
{...props}
to={backTo ?? "/nearby/simple-routes"}
onClick={(event) => {
if (
!event.defaultPrevented &&
event.button === 0 &&
!event.metaKey &&
!event.altKey &&
!event.ctrlKey &&
!event.shiftKey
)
onBack?.();
}}
/>
)
}
/>
);
}
|