Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

thread-inspector-header.tsx

38 lines1.0 KB

1import { useGT } from "gt-react-native";
2​
3import { AppBar } from "../../components/ui/AppBar";
4import { SheetHeader } from "../../components/ui/SheetHeader";
5​
6/** A thread shown outside its route: in the inspector pane, or presented full screen with a close. */
7export type ThreadInspectorPresentation =
8 | { readonly onMaximize: () => void }
9 | { readonly onClose: () => void };
10​
11export function ThreadInspectorHeader(
12 props: ThreadInspectorPresentation & { readonly title: string; readonly subtitle?: string },
13) {
14 const gt = useGT();
15 if ("onMaximize" in props) {
16 return (
17 <AppBar
18 title={props.title}
19 subtitle={props.subtitle}
20 actions={[
21 {
22 accessibilityLabel: gt("Maximize thread"),
23 icon: "arrow.up.left.and.arrow.down.right",
24 onPress: props.onMaximize,
25 },
26 ]}
27 />
28 );
29 }
30 return (
31 <SheetHeader
32 title={props.title}
33 subtitle={props.subtitle}
34 onClose={props.onClose}
35 accessibilityLabel={gt("Close thread")}
36 />
37 );