Skip to content
Source
Sign inSign up

useWorkspaceSidebarHeaderItem.ts

19 lines828 Bytes

1import { useNativeWorkspaceColumnsSupported } from "../../native/NativeWorkspaceColumns";
2import { withNativeGlassHeaderItem } from "./native-glass-header-items";
3import { useSidebarToggle } from "./useSidebarToggle";
4​
5/** `useSidebarToggle` as a native header item. */
6export function useWorkspaceSidebarHeaderItem() {
7 const usesNativeWorkspaceColumns = useNativeWorkspaceColumnsSupported();
8 const toggle = useSidebarToggle();
9 if (!toggle) return null;
10 return withNativeGlassHeaderItem({
11 axisBehavior: usesNativeWorkspaceColumns ? "horizontalOnly" : undefined,
12 accessibilityLabel: toggle.accessibilityLabel,
13 icon: { name: toggle.icon, type: "sfSymbol" as const },
14 identifier: "thread-left-sidebar",
15 label: toggle.accessibilityLabel,
16 onPress: toggle.onPress,
17 type: "button" as const,
18 });