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

workspace-sidebar-toolbar.tsx

32 lines975 Bytes

1import { NativeHeaderToolbar } from "../../native/StackHeader";
2import type { ReactNode } from "react";
3import { Platform } from "react-native";
4​
5import { useAdaptiveWorkspaceLayout } from "./AdaptiveWorkspaceLayout";
6​
7export function WorkspaceSidebarToolbar(
8 props: {
9 readonly children?: ReactNode;
10 readonly afterSidebarButton?: ReactNode;
11 } = {},
12) {
13 const { layout, panes, togglePrimarySidebar } = useAdaptiveWorkspaceLayout();
14​
15 if (Platform.OS === "android" || !layout.usesSplitView) {
16 return null;
17 }
18​
19 return (
20 <NativeHeaderToolbar placement="left">
21 {props.children}
22 <NativeHeaderToolbar.Button
23 accessibilityLabel={
24 panes.primarySidebarVisible ? "Maximize content" : "Show thread sidebar"
25 }
26 icon={panes.primarySidebarVisible ? "arrow.up.left.and.arrow.down.right" : "sidebar.left"}
27 onPress={togglePrimarySidebar}
28 />
29 {props.afterSidebarButton}
30 </NativeHeaderToolbar>
31 );